Deny adding column with comment if the connector does not support this feature#11493
Conversation
49bd2ba to
3df752d
Compare
There was a problem hiding this comment.
I moved the test to BaseConnectorTest.
If the column comment functionality is not available on ADD COLUMN we'll probably need a new entry in TestingConnectorBehavior enum
There was a problem hiding this comment.
Yes, I filed #11486 yesterday.
thanks!
please make sure this Iceberg-specific test method gets removed as part of that issue
There was a problem hiding this comment.
I've largely shrinked the test to concentrate only on adding a column with comment.
However, there is a series of connectors (e.g.: Postgres, MsSQL) which do support adding columns, but ignore the comment provided.
I'll add a new testing behaviour SUPPORTS_ADD_COLUMN_WITH_COMMENT .
3df752d to
383a386
Compare
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
it would be weird for a connector to support ADD COLUMN without CREATE TABLE.
I think we can drop this line.
in the worst case, a connector that has exactly such weird behavior will have to override this method, or we bring the condition back (which will perhaps never happen)
There was a problem hiding this comment.
yeah skipping would just hide such "broken" (IMO) connectors.
There was a problem hiding this comment.
Elasticsearch, Redis seems not to support creating tables, but can add columns
There was a problem hiding this comment.
why do you think Elasticsearch, Redis support adding columns?
There was a problem hiding this comment.
Sorry. My mistake. I misread the test results.
There was a problem hiding this comment.
I think we can drop this line.
let's drop the line
There was a problem hiding this comment.
Dropped the line and also adjusted Redis & Elasticsearch tests to provide appropriate values for the SUPPORTS_ADD_COLUMN behavior. Thank you (yet again) @findepi for stressing on this aspect.
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
08ccda6 to
7638c46
Compare
...n/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/TestingConnectorBehavior.java
Outdated
Show resolved
Hide resolved
7638c46 to
1492897
Compare
There was a problem hiding this comment.
This should be handled by declaring that it doesn't have SUPPORTS_ADD_COLUMN_WITH_COMMENT behavior, and checked that the connector indeed rejects column with a comment.
There was a problem hiding this comment.
Actually the clickhouse connector test supports adding columns only for MergeTree engine tables:
However, the column comment is ignored at the moment. This is the reason why the implementation of the test for the Clickhouse connector simply skips testing the functionality.
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
else (when ! hasBehavior(SUPPORTS_ADD_COLUMN_WITH_COMMENT)) the ALTER TABLE should have failed
There was a problem hiding this comment.
I don't fully understand what you mean.
If the connector does support adding columns without comment it will simply ignore the comment provided, but the ADD COLUMN statement will nevertheless succeed.
There was a problem hiding this comment.
If the connector does support adding columns without comment it will simply ignore the comment provided
This is a bug, see #11348 (talks about table comments, but same story)
There was a problem hiding this comment.
I have updated the PR to reflect this new aspect.
In case that the connector does not support adding a column with comment, it will fail to execute the ADD COLUMN task when the comment is present.
testing/trino-testing/src/main/java/io/trino/testing/TestingConnectorBehavior.java
Outdated
Show resolved
Hide resolved
14f164b to
563b956
Compare
0c5a071 to
7e33573
Compare
|
fyi CI red |
076c28b to
7a989ea
Compare
7a989ea to
9e74970
Compare
6b57929 to
357338b
Compare
5c6b410 to
94f7172
Compare
94f7172 to
2da33a5
Compare
plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/BaseMongoConnectorTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Outdated
Show resolved
Hide resolved
2da33a5 to
8994f03
Compare
…s feature Instead of silently ignoring the column comment if the connector does not support adding column comments, throw explicitly an exception to expose the fact that this feature is not supported.
be3baab to
96de89d
Compare
Description
Deny adding column with comment if the connector does not support this feature
Refactoring
All the connectors
Deny adding column with comment if the connector does not support this feature
Related issues, pull requests, and links
Fixes #11486
Documentation
(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
() No release notes entries required.
(x) Release notes entries required with the following suggested text: