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

Spark 3.5: Use File.separator instead of hardcode in RewriteTablePath #12066

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

manuzhang
Copy link
Collaborator

No description provided.

if (!path.startsWith(toRemove)) {
throw new IllegalArgumentException(
String.format("Path %s does not start with %s", path, toRemove));
}
return path.substring(toRemove.length());
}

public static String appendFileSeparatorIfNotExists(String path) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe maybeAppendFileSeparator?

@szehon-ho
Copy link
Collaborator

szehon-ho commented Jan 23, 2025

Thanks @manuzhang , i saw this too when working on OSSing the original implementation and thought about this but never got around to simplifying it. One doubt I had was, File.separator is potentially different when running on different platform, do we care? Shouldnt we preserve the path/ make the same path if we run on different plartform?

@RussellSpitzer
Copy link
Member

RussellSpitzer commented Jan 23, 2025

Thanks @manuzhang , i saw this too when working on OSSing the original implementation and thought about this but never got around to simplifying it. One doubt I had was, File.separator is potentially different when running on different platform, do we care? Shouldnt we preserve the path/ make the same path if we run on different plartform?

You are right @szehon-ho! This is a mistake on my part. We probably can't do this because the Java ENV in use by the application doesn't necessarily match the files system being used. (almost certainly does not)

For example should my path on S3 be different if I make my Table using an application running from a windows machine vs a linux machine?

Copy link
Member

@RussellSpitzer RussellSpitzer left a comment

Choose a reason for hiding this comment

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

Forgot that the Iceberg Client File.Seperator will have no relationship to the actual Filesystem being used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants