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

   ### Search before asking
   
   I checked existing DuckDB issues and open PRs. #11485 addresses generic 
timezone support for other dialects; this report concerns DuckDB's catalog 
query path.
   
   ### What happened
   
   DuckDB JDBC Source schema discovery for `query` uses the generic JDBC 
converter instead of DuckDB's native mapper. With duckdb_jdbc 1.3.1.0:
   
   | Native query type | Current inferred result | Expected |
   | --- | --- | --- |
   | DECIMAL(20,0) | BIGINT | DECIMAL(20,0), preserving precision and scale |
   | TIMESTAMP WITH TIME ZONE | TIMESTAMP | TIMESTAMP_TZ |
   | UUID / JSON / INTERVAL / HUGEINT | Unsupported JDBC type 1111 | Existing 
DuckDB converter mapping |
   | INTEGER[] / STRUCT | Unsupported JDBC type 2003 / 2002 | STRING, 
consistent with existing native-type handling |
   
   The same problems occur in ordinary DuckDB without DuckLake. Query aliases 
and expressions need the native metadata mapping too. `table_path` already uses 
the DuckDB converter; this report does not propose changing its discovery 
behavior.
   
   ### SeaTunnel Version
   
   3.0.0-SNAPSHOT, dev base 7fa3412e0; duckdb_jdbc 1.3.1.0.
   
   ### SeaTunnel Config
   
   Create a local DuckDB table using JDBC:
   
   ```sql
   CREATE TABLE query_types (id INTEGER, d DECIMAL(20,0), tz TIMESTAMPTZ, u 
UUID);
   INSERT INTO query_types VALUES (1,12345678901234567890,
     TIMESTAMPTZ '2024-01-01 12:34:56.123456+08',
     UUID '550e8400-e29b-41d4-a716-446655440000');
   ```
   
   Then infer/read using this Source configuration:
   
   ```hocon
   env { job.mode = "BATCH", parallelism = 1 }
   source {
     Jdbc {
       url = "jdbc:duckdb:/tmp/query-types.db"
       driver = "org.duckdb.DuckDBDriver"
       query = "SELECT id,d,tz,u FROM query_types"
     }
   }
   sink { Console {} }
   ```
   
   Query `d` and `tz` separately to see the incorrect inferred types; including 
`u` fails discovery.
   
   ### Running Command
   
   Reproduced through `DuckDBCatalog.getTable(String)` and the actual 
`JdbcSourceFactory`/Source flow, independent of the execution engine. The 
companion PR extends the existing DuckDB catalog and Source/Sink test classes. 
On the original production code, the four added regressions fail (two schema 
assertions and two unsupported-type errors).
   
   ### Error Exception
   
   ```text
   expected: Decimal(20, 0), actual: BIGINT
   expected: TIMESTAMP_TZ, actual: TIMESTAMP
   java.lang.UnsupportedOperationException: Unsupported JDBC type: 1111
   ```
   
   ### Java or Scala Version
   
   JDK 8 and 17.
   
   ### Are you willing to submit PR?
   
   Yes, a focused native query-metadata fix with regressions and EN/ZH 
migration notes is ready.
   
   ### Code of Conduct
   
   I agree to follow the project's Code of Conduct.
   


-- 
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