-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-51849][SQL] Refactoring ResolveDDLCommandStringTypes
#50609
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-51849][SQL] Refactoring ResolveDDLCommandStringTypes
#50609
Conversation
|
Let's file a JIRA and fill the PR description. Also would need a test |
b35621d to
6eaa310
Compare
ResolveDDLCommandStringTypes
| * can take various forms. | ||
| */ | ||
| object ResolveDDLCommandStringTypes extends Rule[LogicalPlan] { | ||
| object ApplyDefaultCollationToStringType extends Rule[LogicalPlan] { |
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.
Wouldn't it make more sense to move this to the type coercion framework? Like CollationTypeCoercion?
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.
Otherwise it's confusing - we are applying collations to string types in the CollationTypeCoercion, but for some reason the logic of applying a view-originated collation is in some separate rule outside.
8541c6a to
33bb12d
Compare
|
thanks, merging to master/4.0! |
### What changes were proposed in this pull request? `ResolveDDLCommandStringTypes` renamed to `ApplyDefaultCollationToStringType`. ### Why are the changes needed? This is needed because this rule applies also to non-DDL plans (when querying View). ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? ### Was this patch authored or co-authored using generative AI tooling? No. Closes #50609 from ilicmarkodb/split_resolve_ddl_and_view. Authored-by: ilicmarkodb <marko.ilic@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit c86f617) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
…efaultCollation should be consistent with transform ### What changes were proposed in this pull request? This is a followup of #50609 . `fetchDefaultCollation` should be consistent with `transform`, but now `fetchDefaultCollation` tries to get the table metadata from all ALTER TABLE commands, and custom v2 tables may have side effects when returning the table properties. This PR fixes it to only get table metadata for targeting commands that will be handled in `transform`. ### Why are the changes needed? fix potential regressions ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? N/A ### Was this patch authored or co-authored using generative AI tooling? No Closes #50808 from cloud-fan/follow. Lead-authored-by: Wenchen Fan <wenchen@databricks.com> Co-authored-by: Wenchen Fan <cloud0fan@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
…efaultCollation should be consistent with transform ### What changes were proposed in this pull request? This is a followup of #50609 . `fetchDefaultCollation` should be consistent with `transform`, but now `fetchDefaultCollation` tries to get the table metadata from all ALTER TABLE commands, and custom v2 tables may have side effects when returning the table properties. This PR fixes it to only get table metadata for targeting commands that will be handled in `transform`. ### Why are the changes needed? fix potential regressions ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? N/A ### Was this patch authored or co-authored using generative AI tooling? No Closes #50808 from cloud-fan/follow. Lead-authored-by: Wenchen Fan <wenchen@databricks.com> Co-authored-by: Wenchen Fan <cloud0fan@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 4574feb) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
…efaultCollation should be consistent with transform ### What changes were proposed in this pull request? This is a followup of apache#50609 . `fetchDefaultCollation` should be consistent with `transform`, but now `fetchDefaultCollation` tries to get the table metadata from all ALTER TABLE commands, and custom v2 tables may have side effects when returning the table properties. This PR fixes it to only get table metadata for targeting commands that will be handled in `transform`. ### Why are the changes needed? fix potential regressions ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? N/A ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#50808 from cloud-fan/follow. Lead-authored-by: Wenchen Fan <wenchen@databricks.com> Co-authored-by: Wenchen Fan <cloud0fan@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
### What changes were proposed in this pull request? `ResolveDDLCommandStringTypes` renamed to `ApplyDefaultCollationToStringType`. ### Why are the changes needed? This is needed because this rule applies also to non-DDL plans (when querying View). ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#50609 from ilicmarkodb/split_resolve_ddl_and_view. Authored-by: ilicmarkodb <marko.ilic@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 4c18f2d) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
…efaultCollation should be consistent with transform ### What changes were proposed in this pull request? This is a followup of apache#50609 . `fetchDefaultCollation` should be consistent with `transform`, but now `fetchDefaultCollation` tries to get the table metadata from all ALTER TABLE commands, and custom v2 tables may have side effects when returning the table properties. This PR fixes it to only get table metadata for targeting commands that will be handled in `transform`. ### Why are the changes needed? fix potential regressions ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? N/A ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#50808 from cloud-fan/follow. Lead-authored-by: Wenchen Fan <wenchen@databricks.com> Co-authored-by: Wenchen Fan <cloud0fan@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 280977e) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
What changes were proposed in this pull request?
ResolveDDLCommandStringTypesrenamed toApplyDefaultCollationToStringType.Why are the changes needed?
This is needed because this rule applies also to non-DDL plans (when querying View).
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Was this patch authored or co-authored using generative AI tooling?
No.