Skip to content

Core: TableMetadata Always Strips Trailing Slash From Location#6777

Merged
jackye1995 merged 3 commits into
apache:masterfrom
RussellSpitzer:RemoveLocationTrailingSlash
Feb 9, 2023
Merged

Core: TableMetadata Always Strips Trailing Slash From Location#6777
jackye1995 merged 3 commits into
apache:masterfrom
RussellSpitzer:RemoveLocationTrailingSlash

Conversation

@RussellSpitzer
Copy link
Copy Markdown
Member

Previously we could end up in situations where we unintentionally we would create // in file paths which is an issue with non-POSIX FileIOs.

This is a partial fix for #6758

Previously we could end up in situations where we unintentionally we would
create // in file paths which is an issue with non-POSIX FileIOs.
@github-actions github-actions Bot added the core label Feb 8, 2023
@RussellSpitzer
Copy link
Copy Markdown
Member Author

@jackye1995 + @rdblue + @aokolnychyi + @danielcweeks + @amogh-jahagirdar + @findepi

This fixes only instances of accidental trailing slashes in the table locations. This would have a slight change in behavior for tables which are currently using S3FIleIO and have a trailing slash. new files for those tables will end up in single slash paths. Old files will be unaffected.

@RussellSpitzer
Copy link
Copy Markdown
Member Author

Cleaning up tests now, we have many tests that are using trailing slashes in table location

Copy link
Copy Markdown
Contributor

@jackye1995 jackye1995 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Copy Markdown
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

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

One nit, but it's non-blocking at this point, just want to get yours and others takes on it. Thanks @RussellSpitzer !

this.formatVersion = formatVersion;
this.uuid = uuid;
this.location = location;
this.location = location != null ? LocationUtil.stripTrailingSlash(location) : null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: I feel like we should just change LocationUtil.stripTrailingSlash to return null if a null location is passed in instead of throwing an NPE otherwise I think we have to do this null check everywhere where we don't have a location defined in advance. But it's a public utility which may be used beyond the Iceberg library itself so I understand not wanting to change it at this point.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is the only place location could be null? In all other places location is already initialized and must be non-null.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see if that's the case then we should just leave as is imo

@findepi
Copy link
Copy Markdown
Member

findepi commented Feb 9, 2023

cc @ebyhr @electrum @alexjo2144

Copy link
Copy Markdown
Contributor

@yyanyy yyanyy left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@jackye1995
Copy link
Copy Markdown
Contributor

Thanks for the fix @RussellSpitzer , and thanks for the review @amogh-jahagirdar , @nastra , @yyanyy ! I will rebase #6772 after this is merged.

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.

6 participants