Skip to content
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-48413][SQL][FOLLOW-UP] Fix ALTER COLUMN with collation #48582

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jovanm-db
Copy link

@jovanm-db jovanm-db commented Oct 21, 2024

What changes were proposed in this pull request?

Fixing the analysis check error introduced in PR.

Why are the changes needed?

Change is needed to enable altering column with all datasources and identifier variations.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added tests to CollationSuite.

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

No.

@github-actions github-actions bot added the SQL label Oct 21, 2024
Comment on lines 523 to 524
sql(s"ALTER TABLE $tableName ALTER COLUMN c1 TYPE STRING COLLATE UTF8_LCASE")
sql(s"INSERT INTO $tableName VALUES ('a')")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
sql(s"ALTER TABLE $tableName ALTER COLUMN c1 TYPE STRING COLLATE UTF8_LCASE")
sql(s"INSERT INTO $tableName VALUES ('a')")
sql(s"INSERT INTO $tableName VALUES ('a')")
sql(s"ALTER TABLE $tableName ALTER COLUMN c1 TYPE STRING COLLATE UTF8_LCASE")

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's first insert and then alter, seems a bit nicer for the test.

Copy link
Contributor

@stefankandic stefankandic left a comment

Choose a reason for hiding this comment

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

Please explain you change a bit more in the PR description

@@ -516,6 +516,16 @@ class CollationSuite extends DatasourceV2SQLBase with AdaptiveSparkPlanHelper {
}
}

test("SPARK-48413: Alter column with collation") {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we also add tests for complex types (struct, map, array)?

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.

3 participants