Skip to content

[SPARK-57054][SQL] Make view collation sticky across ALTER SCHEMA DEFAULT COLLATION#56100

Open
ilicmarkodb wants to merge 1 commit into
apache:masterfrom
ilicmarkodb:marko-ilic_data/spark_view_def_collation
Open

[SPARK-57054][SQL] Make view collation sticky across ALTER SCHEMA DEFAULT COLLATION#56100
ilicmarkodb wants to merge 1 commit into
apache:masterfrom
ilicmarkodb:marko-ilic_data/spark_view_def_collation

Conversation

@ilicmarkodb
Copy link
Copy Markdown
Contributor

@ilicmarkodb ilicmarkodb commented May 25, 2026

What changes were proposed in this pull request?

Remove the AlterViewAs rewrite case from ApplyDefaultCollation.resolveDefaultCollation. It used to fold the namespace's current default collation into a view whose persisted PROP_COLLATION was empty, on every ALTER VIEW AS.

Why are the changes needed?

A view's collation should be fixed at creation time. The removed rewrite let a later ALTER SCHEMA ... DEFAULT COLLATION retroactively change an existing view's literal types on the next ALTER VIEW AS:

CREATE SCHEMA s;
CREATE VIEW v AS SELECT 'a' AS c1;            -- UTF8_BINARY
ALTER SCHEMA s DEFAULT COLLATION UTF8_LCASE;
ALTER VIEW v AS SELECT 'x' AS c1;             -- was: UTF8_LCASE; now: UTF8_BINARY

Does this PR introduce any user-facing change?

Yes. ALTER VIEW AS no longer picks up the namespace's current default collation for a view that was created without one — the view's collation stays sticky from creation.

How was this patch tested?

Updated the existing V1 and V2 tests to assert the new sticky behavior.

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

No.

@ilicmarkodb ilicmarkodb changed the title temp [SPARK-XXXXX][SQL] Make view collation sticky across ALTER SCHEMA DEFAULT COLLATION May 25, 2026
@ilicmarkodb ilicmarkodb changed the title [SPARK-XXXXX][SQL] Make view collation sticky across ALTER SCHEMA DEFAULT COLLATION [SPARK-57054][SQL] Make view collation sticky across ALTER SCHEMA DEFAULT COLLATION May 25, 2026
@ilicmarkodb ilicmarkodb force-pushed the marko-ilic_data/spark_view_def_collation branch from 33345d8 to 2fbf5cf Compare May 25, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant