Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update locate_parquet_testing_files function to support hdfs input path for dataproc CI #10356

Merged
merged 3 commits into from
Feb 6, 2024

Conversation

yinqingh
Copy link
Collaborator

@yinqingh yinqingh commented Feb 1, 2024

To fix #10255

Add hdfs_glob function to support hdfs path.

Signed-off-by: Yinqing Hao <haoyinqing@gmail.com>
@jlowe jlowe added the test Only impacts tests label Feb 1, 2024
Copy link
Member

@jlowe jlowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be targeted to 24.04 since the corresponding issue was moved to 24.04.

integration_tests/src/main/python/parquet_testing_test.py Outdated Show resolved Hide resolved
integration_tests/src/main/python/parquet_testing_test.py Outdated Show resolved Hide resolved
integration_tests/src/main/python/parquet_testing_test.py Outdated Show resolved Hide resolved
Signed-off-by: Yinqing Hao <haoyinqing@gmail.com>
@yinqingh yinqingh changed the base branch from branch-24.02 to branch-24.04 February 2, 2024 02:02
@yinqingh
Copy link
Collaborator Author

yinqingh commented Feb 2, 2024

Retargeted to 24.04

Copy link
Member

@jlowe jlowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copyrights that I missed in the first review and a minor suggestion but otherwise lgtm.

Signed-off-by: Yinqing Hao <haoyinqing@gmail.com>
@yinqingh
Copy link
Collaborator Author

yinqingh commented Feb 5, 2024

build

1 similar comment
@NvTimLiu
Copy link
Collaborator

NvTimLiu commented Feb 5, 2024

build

"""
path_str = path.as_posix()
full_pattern = path_str + '/' + pattern
cmd = ['hadoop', 'fs', '-ls', '-C', full_pattern]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be possible to call FileSystem globStatus directly via PY4J without forking the JVM via hadoop fs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Gera, Thanks for the review!

I tried following code to use PY4J to glob files by patterns and it works as well.
But seems it's not so straightforward like hadoop fs -ls command and also we need to process the path string further.

Considering the readability, I think probably we could keep the current implementation?

Suggested change
cmd = ['hadoop', 'fs', '-ls', '-C', full_pattern]
path_str = path.as_posix()
full_pattern = path_str + '/' + pattern
sc = get_spark_i_know_what_i_am_doing().sparkContext
config = sc._jsc.hadoopConfiguration()
fs_path = sc._jvm.org.apache.hadoop.fs.Path(full_pattern)
fs = sc._jvm.org.apache.hadoop.fs.FileSystem.get(config)
statuses = fs.globStatus(fs_path)
for status in statuses:
# status.getPath().toString() return string like "hdfs://hostname:8020/src/test/resources/parquet-testing/data/single_nan.parquet"
# but pathlib.Path will remove the first "/" and convert it to "hdfs:/hostname:8020/src/test/resources/parquet-testing/data/single_nan.parquet" and then this path becomes illegal.
# so we need to process the path like this.
p = f'hdfs:{status.getPath().toUri().getPath()}'
yield Path(p)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it readable enough. Not a must-fix but probably would save us trouble-shooting various OOMs and other resource issues down the road. Especially in the xdist case. Keep in mind JVM initialization is slow. Hadoop adds significant XML parsing overhead on top of it. We can file it as a potential improvement and mitigation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will file it as a improvement. Thanks a lot!

@yinqingh yinqingh merged commit b9da628 into NVIDIA:branch-24.04 Feb 6, 2024
39 of 40 checks passed
@yinqingh yinqingh deleted the fix-hdfs-parquet-file-path branch February 6, 2024 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Only impacts tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] parquet_tests are skipped on Dataproc CI
6 participants