hutiefang76 opened a new issue, #12590:
URL: https://github.com/apache/seatunnel/issues/12590

   ### Search before asking
   
   Checked existing DuckDB BIT/ENUM issues and open PRs. This is a downstream 
schema-length problem, separate from native query schema and unsigned numeric 
mappings.
   
   ### What happened
   
   The DuckDB catalog reports no character length for BIT or ENUM. The 
converter substitutes 1 for BIT and 255 for an ENUM declaration. MySQL 
automatic DDL then creates `bits VARCHAR(1)` and `en VARCHAR(255)`.
   
   A real DuckDB column containing `'10110'::BIT` and an ENUM with a 
400-character label produces two MySQL insert failures with SQLState `22001` 
(`Data too long for column`). The same values, plus NULL controls, fit in 
LONGTEXT.
   
   ### Expected behavior
   
   Preserve the unknown length of these STRING columns instead of inventing a 
fixed limit. The downstream connector can select its unbounded string mapping; 
MySQL uses LONGTEXT. Existing destination tables require their own schema 
migration.
   
   ### Reproduction
   
   1. In DuckDB, create an ENUM type containing a 400-character label and a 
table with BIT and that ENUM column. Insert `'10110'` and the label.
   2. Obtain the table through DuckDBCatalog.getTable(TablePath) and generate 
MySQL DDL with MysqlCreateTableSqlBuilder using that schema.
   3. Execute the generated DDL on MySQL 8.0.43 and insert the values. The 
generated VARCHAR(1)/VARCHAR(255) columns reject them with SQLState 22001.
   
   This was reproduced with the actual native DuckDB catalog, production MySQL 
DDL builder and MySQL writes. The proposed patch adds coverage for null, zero 
and positive metadata lengths, an ENUM array fallback control, the existing 
catalog test and JdbcMysqlIT.
   
   ### Version
   
   Current dev, 3.0.0-SNAPSHOT; duckdb_jdbc 1.3.1.0; MySQL 8.0.43; JDK 8 and 
17. No released-version range or backport claim.
   
   ### Are you willing to submit PR?
   
   Yes. A small converter fix preserves unknown BIT/ENUM lengths while 
retaining positive lengths and the unrelated fallback mappings.
   
   AI disclosure: Codex assisted this report; DeepSeek and Codex assisted the 
proposed code and tests.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to