-
Notifications
You must be signed in to change notification settings - Fork 234
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
Update locate_parquet_testing_files function to support hdfs input path for dataproc CI #10356
Conversation
Signed-off-by: Yinqing Hao <[email protected]>
There was a problem hiding this 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.
Signed-off-by: Yinqing Hao <[email protected]>
Retargeted to 24.04 |
There was a problem hiding this 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 <[email protected]>
build |
1 similar comment
build |
""" | ||
path_str = path.as_posix() | ||
full_pattern = path_str + '/' + pattern | ||
cmd = ['hadoop', 'fs', '-ls', '-C', full_pattern] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
To fix #10255
Add
hdfs_glob
function to support hdfs path.