Skip to content

[SPARK-47399][SQL] Disable generated columns on expressions with collations - #45520

Closed
stefankandic wants to merge 2 commits into
apache:masterfrom
stefankandic:disableGeneratedColumnsCollation
Closed

stefankandic wants to merge 2 commits into
apache:masterfrom
stefankandic:disableGeneratedColumnsCollation

Conversation

@stefankandic

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Disable the ability to use collations in expressions for generated columns.

Why are the changes needed?

Changing the collation of a column or even just changing the ICU version could lead to a differences in the resulting expression so it would be best if we simply disable it for now.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

With new unit tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions Bot added the SQL label Mar 14, 2024
}
if (analyzed.exists(e => SchemaUtils.hasNonDefaultCollatedString(e.dataType))) {
throw unsupportedExpressionError(
"generation expression cannot contain non-default collated string type")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is not fully related to the PR, but I believe we should introduce sub-classes of UNSUPPORTED_EXPRESSION_GENERATED_COLUMN instead of the reason message paremeter.

@MaxGekk

MaxGekk commented Mar 15, 2024

Copy link
Copy Markdown
Member

+1, LGTM. Merging to master.
Thank you, @stefankandic.

@MaxGekk MaxGekk closed this in 4b1f8c3 Mar 15, 2024
@stefankandic
stefankandic deleted the disableGeneratedColumnsCollation branch March 15, 2024 11:15
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.

2 participants