[Fix][Connector-V2] Fix dameng create table failed bug #10959
[Fix][Connector-V2] Fix dameng create table failed bug #10959happybrant wants to merge 1 commit into
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for working on this. I reviewed the full diff on the current head and traced the real Dameng catalog create-table path end to end.
What this PR fixes
- User pain: Dameng table creation can fail when column comments are emitted as part of one large DDL string.
- Fix approach: split the
CREATE TABLEstatement and eachCOMMENT ON COLUMNinto separate SQL statements. - One-line summary: the direction is correct, but the current revision still leaves one real runtime gap in the comment SQL path and one deterministic test mismatch.
Runtime chain I checked
catalog create-table path
-> AbstractJdbcCatalog.createTable(...) [AbstractJdbcCatalog.java:443-472]
-> AbstractJdbcCatalog.createTableInternal(...) [AbstractJdbcCatalog.java:485-497]
-> DamengCatalog.getCreateTableSqls(...) [DamengCatalog.java:115-117]
-> DamengCreateTableSqlBuilder.build(...) [DamengCreateTableSqlBuilder.java:56-109]
-> SQL[0] = CREATE TABLE ...
-> SQL[1..n] = COMMENT ON COLUMN ...
-> executeInternal(dbUrl, sql) // executes every statement one by one
comment SQL generation
-> DamengCreateTableSqlBuilder.buildColumnCommentSql(...) [DamengCreateTableSqlBuilder.java:157-168]
-> current head appends column.getComment() directly into IS '...'
-> comments containing a single quote still produce invalid SQL
Findings
- The normal catalog create-table path really does hit the new split-SQL contract.
- Splitting the statements is the right fix for the original Dameng DDL execution issue.
- However, the current head still leaves the comment-content escaping problem unresolved.
- The updated unit test is not flaky from a timing/resource perspective, but one new assertion is currently inconsistent with the builder output on the
createIndex=falsepath.
Merge conclusion
Conclusion: can merge after fixes
- Blocking items
- Issue 1:
DamengCreateTableSqlBuilder.java:157-168still appendscolumn.getComment()directly intoIS '...'without escaping'. So if a column comment is something likeBob's column, the newCOMMENT ON COLUMNstatement still breaks on the real create-table path. The same JDBC catalog family already escapes this pattern in builders such asOracleCreateTableSqlBuilder.java:144-154. Please escape single quotes here as well and add a regression test for that case. - Issue 2:
DamengCreateTableSqlBuilderTest.java:133-147now expects thecreateIndex=falsecreate-table SQL to end with);, butDamengCreateTableSqlBuilder.build(...)currently returns the first statement with)only. That is a deterministic mismatch rather than a flaky test pattern, so this assertion needs to be corrected before merge.
- Suggested non-blocking follow-up
- No extra non-blocking requests from my side beyond covering the escaped-comment case in the unit test.
Overall, the split-SQL approach is the right foundation. Once the comment escaping and the test mismatch are closed, this should be in much better shape for merge.
|
Thanks @davidzollo. I saw the screenshot. On the current unchanged head |

fix #10955