Support column properties with jdbc connector#25174
Conversation
|
This pull request has gone a while without any activity. Ask for help on #core-dev on Trino slack. |
7309388 to
dbc00bb
Compare
dbc00bb to
7630693
Compare
7630693 to
dbc00bb
Compare
|
The JdbcColumnHandle may include all the information returned by DatabaseMetaData.getColumns()? @chenjian2664 @ebyhr So which way is better? |
ebyhr
left a comment
There was a problem hiding this comment.
Please update MySQL connector's documentation.
There was a problem hiding this comment.
Replace order of IntegerType and BigintType. We usually order as smaller → larger.
Also, I think this limitation is wrong. We can enable auto increment on tinyint and smallint types.
There was a problem hiding this comment.
Replace order of IntegerType and BigintType. We usually order as smaller → larger. Also, I think this limitation is wrong. We can enable auto increment on tinyint and smallint types.
Using AUTO_INCREMENT with float and double columns is deprecated as of MySQL 8.0.17 and support for it to be removed in a future version of MySQL. So we should only support integer types. I initially thought that the value ranges of TINYINT and SMALLINT were limited, so I assumed these two data types were not supported at first. I have added them.
dbc00bb to
ea695d8
Compare
ea695d8 to
3c514c5
Compare
3c514c5 to
abd364a
Compare
There was a problem hiding this comment.
is it possible to add this into DefaultJdbcMetadata directly?
There was a problem hiding this comment.
Why not add the auto increment info here, so we can use it in DefaultJdbcMetadata directly
There was a problem hiding this comment.
Maybe different datasource will use different column properties, so different datasource will have their own getColumnMetadata from JdbcColumnHandle. If we are sure on how each datasource behave,we can unify them in JdbcColumnHandle#getColumnMetadata.
There was a problem hiding this comment.
Feel like maybe we could make this filed to Optional<Boolean>, use empty to mark the column not support such property.
There was a problem hiding this comment.
autoIncrement only mark column can auto generate or not, it would be like nullable. It can use datasource Metadata to control support such property or not.
|
@ebyhr PTAL and let me know if there's anything else to adjust. |
There was a problem hiding this comment.
Why did you move the section? Please separate a commit for moving.
There was a problem hiding this comment.
Table properties or column properties are part of the table management. So I move it into Schema and table management section
There was a problem hiding this comment.
The requireNonNull isn't required in case of ImmutableSet.copyOf.
There was a problem hiding this comment.
"Unsupported column type for AUTO_INCREMENT: " + type
There was a problem hiding this comment.
getColumnMetadata -> toColumnMetadata
There was a problem hiding this comment.
This may overwrite the existing extra info. Please verify handle.getColumnMetadata().getExtraInfo() is empty.
There was a problem hiding this comment.
Do we have the test coverage about a table having primary_key in a different order?
CREATE TABLE test(a bigint NOT NULL, b bigint NOT NULL WITH (auto_increment = true), c bigint) WITH (primary_key = ARRAY['b', 'a']);abd364a to
0539692
Compare
6b56ada to
dc120c9
Compare
|
@ebyhr PTAL and let me know if there's anything else to adjust. Thanks |
dc120c9 to
8c8c3cc
Compare
|
This pull request has gone a while without any activity. Ask for help on #core-dev on Trino slack. |
8c8c3cc to
651c622
Compare
|
@ebyhr @chenjian2664 @Praveen2112 Could you PTAL at this PR ? Thanks |
|
This pull request has gone a while without any activity. Ask for help on #core-dev on Trino slack. |
|
Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time. |
Description
Add column properties for base jdbc connector to support auto_increment, default value 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: