-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix: rename column failed if the column is used as source column of non-identity transform #25697
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
Merged
hantangwangd
merged 1 commit into
prestodb:master
from
PingLiuPing:lp_iceberg_fix_rename_column
Aug 22, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@PingLiuPing @hantangwangd Is there any reason why we need two matchers for each transform? I see one is for matching with "()", the other is matching "[]". The names are very confusing because the
COLUMN_xxxis also in Iceberg:The
ICEBERG_flavor vars were used in PartitionFields.java:public class ConnectorTableMetadata
{
private final SchemaTableName table;
private final Optional comment;
private final List columns; // With "bucket[]"?
private final Map<String, Object> properties; // with "bucket()"
private final TableConstraintsHolder tableConstraintsHolder;
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.
Thanks for bring this for discussing @yingsu00. As I see, the partitioning definition maintained in the properties of
ColumnMetadata(which currently appears to exist only when executingadd columnstatements) always be in the form of(), which is consistent with our syntax for add columns:The newly added logic in
getPartitionColumnNameis used to build new target partition field name when executingalter column name. In this scenario, we know the column's target name and it's related Iceberg transforms, however, the output oftransform.toString()is in the form of[](e.g.bucket[4]). Therefore, we need to parse and identify this form as well.In summary, one regex is for parsing Presto SQL syntax, and the other is for parsing the
toString()output of Iceberg partition transforms. But I agree that it seems a little confuse to mix them all in the methodgetPartitionColumnName, this could make later readers wonder if we're also maintaining[]form in some other places. Do you think it would be more reasonable to split them into two separate methods with clear responsibilities? Or is there a better way you'd suggest? @yingsu00 @PingLiuPingUh oh!
There was an error while loading. Please reload this page.
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.
Thanks @yingsu00 for your comments.
Thanks @hantangwangd for your explanation. You are correct. ICEBERG_ regex is for parsing the transform string from PartitionField.transform().toString(). And the output string is in the format of
bucket[4]ortruncate[5].Yes, this is the reason that I just add ICEBERG_ regex in this method
getPartitionColumnName.I think it is ok to add those two matchers in this method
getPartitionColumnName. And from the method name and parameters we can tell that this method's purpose is building a special format of column name based on input. Here we just make it handle an extra format of transform string.Anyway, happy to separate this method and add a new single purpose method if required.