-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Disallow using reserved column names for Delta CDF tables #16953
Conversation
715e8b1
to
2d0cea4
Compare
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Show resolved
Hide resolved
This PR relates to #15821 |
{ | ||
Set<String> conflicts = Sets.intersection(columnNames, CHANGE_DATA_FEED_COLUMN_NAMES); | ||
if (!conflicts.isEmpty()) { | ||
throw new TrinoException(NOT_SUPPORTED, "Unable to use %s when change data feed is enabled: %s".formatted(CHANGE_DATA_FEED_COLUMN_NAMES, conflicts)); |
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.
Unable to use %s
-> Unable to use %s column name(s)
Unable to use [_change_type] when change data feed is enabled
Let's cosmetize a bit the message shown to the end user - maybe use a string joiner to add quotes to each illegal column name.
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.
IMO, we could also indicate that the column names are reserved
.
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Outdated
Show resolved
Hide resolved
{ | ||
Set<String> conflicts = Sets.intersection(columnNames, CHANGE_DATA_FEED_COLUMN_NAMES); | ||
if (!conflicts.isEmpty()) { | ||
throw new TrinoException(NOT_SUPPORTED, "Unable to use %s when change data feed is enabled: %s".formatted(CHANGE_DATA_FEED_COLUMN_NAMES, conflicts)); |
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.
IMO, we could also indicate that the column names are reserved
.
...rino-delta-lake/src/test/java/io/trino/plugin/deltalake/BaseDeltaLakeMinioConnectorTest.java
Show resolved
Hide resolved
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Outdated
Show resolved
Hide resolved
{ | ||
try (TestTable table = new TestTable(getQueryRunner()::execute, "test_add_column", "(col int) WITH (change_data_feed_enabled = true)")) { | ||
assertQueryFails( | ||
"ALTER TABLE " + table.getName() + " ADD COLUMN " + columnName + " int", |
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.
add also a test with RENAME COLUMN (the test table should use column mapping mode)
currently not supported, but will ensure we keep desired test coverage when implementing rename column feature
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.
#15821 already contains the test to deny CDF column names in RENAME COLUMN. Let me skip adding the test to this PR.
plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java
Outdated
Show resolved
Hide resolved
2d0cea4
to
d39e875
Compare
d39e875
to
ba326e7
Compare
Description
Disallow using reserved column names for Delta CDF tables
Fixes #16913
Release notes
(x) Release notes are required, with the following suggested text: