Skip to content

Conversation

hqbhoho
Copy link
Contributor

@hqbhoho hqbhoho commented Sep 5, 2025

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:

## Mysql
*  Add support for creating tables with `auto_increment` column property.

@cla-bot cla-bot bot added the cla-signed label Sep 5, 2025
@github-actions github-actions bot added docs mysql MySQL connector labels Sep 5, 2025
@hqbhoho
Copy link
Contributor Author

hqbhoho commented Sep 5, 2025

@ebyhr @chenjian2664 Could you help review it? Thanks

@hqbhoho hqbhoho requested review from chenjian2664 and ebyhr and removed request for chenjian2664 September 5, 2025 06:25
@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch 2 times, most recently from 521ff3e to cf6c266 Compare September 8, 2025 03:45
@hqbhoho hqbhoho requested a review from Praveen2112 September 8, 2025 04:51
@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch 2 times, most recently from 64d84a9 to 9ce5fcb Compare September 9, 2025 01:01
Copy link
Contributor

@chenjian2664 chenjian2664 left a 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?

public void testCreateTableWithAutoIncrementColumn()
{
verifyCreateTableDefinition(
"(a tinyint NOT NULL WITH (auto_increment = true), b bigint, c bigint) WITH (primary_key = ARRAY['a'])",
Copy link
Contributor

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?

Copy link
Contributor Author

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.

* Returns the estimated size of a property value.
* <p>
* Supported types are the same as those accepted by
* {@link io.trino.metadata.PropertyUtil#toExpression}.
Copy link
Contributor

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 ?

Copy link
Contributor Author

@hqbhoho hqbhoho Sep 11, 2025

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

@hqbhoho
Copy link
Contributor Author

hqbhoho commented Sep 11, 2025

Wondering the auto_increment can be false?

Thank you for your feedback!

Currently, the MySQLClient#getColumnProperties method ignores the "IS_AUTOINCREMENT" property unless its value is explicitly "YES". Allowing the creation of tables in Trino using WITH (auto_increment = false) is unnecessary, as this configuration is meaningless in this context.

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

@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch from 9ce5fcb to aba59d3 Compare September 11, 2025 10:00
@hqbhoho hqbhoho force-pushed the feature/support_column_properties_with_jdbc_connector branch from aba59d3 to b5c1436 Compare September 12, 2025 02:28
@github-actions github-actions bot added the ignite Ignite connector label Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed docs ignite Ignite connector mysql MySQL connector
Development

Successfully merging this pull request may close these issues.

3 participants