Skip to content

Conversation

@ilicmarkodb
Copy link
Contributor

@ilicmarkodb ilicmarkodb commented Apr 16, 2025

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.

@github-actions github-actions bot added the SQL label Apr 16, 2025
@HyukjinKwon
Copy link
Member

Let's file a JIRA and fill the PR description. Also would need a test

@ilicmarkodb ilicmarkodb changed the title Split resolve ddl and view [WIP] Split resolve ddl and view Apr 17, 2025
@ilicmarkodb ilicmarkodb force-pushed the split_resolve_ddl_and_view branch from b35621d to 6eaa310 Compare April 19, 2025 13:09
@ilicmarkodb ilicmarkodb changed the title [WIP] Split resolve ddl and view [SPARK-51849][SQL] Refactoring ResolveDDLCommandStringTypes Apr 19, 2025
* can take various forms.
*/
object ResolveDDLCommandStringTypes extends Rule[LogicalPlan] {
object ApplyDefaultCollationToStringType extends Rule[LogicalPlan] {
Copy link
Contributor

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?

Copy link
Contributor

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.

@ilicmarkodb ilicmarkodb force-pushed the split_resolve_ddl_and_view branch from 8541c6a to 33bb12d Compare April 20, 2025 23:20
@cloud-fan
Copy link
Contributor

thanks, merging to master/4.0!

@cloud-fan cloud-fan closed this in c86f617 Apr 22, 2025
cloud-fan pushed a commit that referenced this pull request Apr 22, 2025
### 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>
cloud-fan added a commit that referenced this pull request May 7, 2025
…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>
cloud-fan added a commit that referenced this pull request May 7, 2025
…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>
yhuang-db pushed a commit to yhuang-db/spark that referenced this pull request Jun 9, 2025
…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>
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 14, 2025
### 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>
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 14, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants