-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Support column properties with jdbc connector #26561
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
base: master
Are you sure you want to change the base?
Support column properties with jdbc connector #26561
Conversation
@ebyhr @chenjian2664 Could you help review it? Thanks |
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcColumnHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-mysql/src/main/java/io/trino/plugin/mysql/MySqlMetadata.java
Outdated
Show resolved
Hide resolved
521ff3e
to
cf6c266
Compare
64d84a9
to
9ce5fcb
Compare
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.
Wondering the auto_increment
can be false?
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcColumnHandle.java
Outdated
Show resolved
Hide resolved
public void testCreateTableWithAutoIncrementColumn() | ||
{ | ||
verifyCreateTableDefinition( | ||
"(a tinyint NOT NULL WITH (auto_increment = true), b bigint, c bigint) WITH (primary_key = ARRAY['a'])", |
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.
Does it allow specifying auto_increment as false?
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.
You are right, we need add a check to prevent the creation of tables in Trino using WITH (auto_increment = false).It is meaningless.
plugin/trino-mysql/src/main/java/io/trino/plugin/mysql/MySqlClient.java
Outdated
Show resolved
Hide resolved
* Returns the estimated size of a property value. | ||
* <p> | ||
* Supported types are the same as those accepted by | ||
* {@link io.trino.metadata.PropertyUtil#toExpression}. |
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.
Why accept the same as PropertyUtil#toExpression
?
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.
SHOW CREATE TABLE
will use PropertyUtil#toExpression
parse property value to Expression
. So here, I want to restrict the types of property values. I should put this check in JdbcColumnHandle#Constructor
and then estimatedObjectSizeOf
only needs to support the legal types. Or do you have any better suggestions
Thank you for your feedback! Currently, the To address this, I will implement a validation check to prevent such table creation attempts and add corresponding test cases to ensure the functionality works as expected |
9ce5fcb
to
aba59d3
Compare
aba59d3
to
b5c1436
Compare
Description
ReOpening #25174 since it went stale.
Add column properties for base jdbc connector to support auto_increment and other column attribute.
When running SHOW CREATE TABLE include column properties present for these column attribute.
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: