gravitino icon indicating copy to clipboard operation
gravitino copied to clipboard

[Bug report] Trino Connector Fails to Read MySQL Timestamp Columns with Precision

Open predator4ann opened this issue 9 months ago • 0 comments

Version

main branch

Describe what's wrong

When using the Trino connector to read MySQL tables containing timestamp columns with precision specification (e.g., TIMESTAMP(6)), the query fails with a type conversion error.

Error message and/or stacktrace

trino> select created_at from ext.tmp.test_table limit 10;
 created_at
------------
(0 rows)

Query 20250310_092550_25102_uxzme, FAILED, 1 node
Splits: 1 total, 1 done (100.00%)
0.57 [10 rows, 0B] [17 rows/s, 0B/s]

Query 20250310_092550_25102_uxzme failed: Could not serialize column 'created_at' of type 'timestamp(0)' at position 1:1

Caused by: java.lang.IllegalArgumentException: Expected 0s for digits beyond precision 0: epochMicros = 1679540780487000
	at io.trino.spi.type.SqlTimestamp.newInstance(SqlTimestamp.java:64)
	at io.trino.spi.type.ShortTimestampType.getObjectValue(ShortTimestampType.java:149)
	at io.trino.server.protocol.QueryResultRows$ResultsIterator.getRowValues(QueryResultRows.java:333)

How to reproduce

  1. Create a MySQL table with a timestamp column with precision:
    CREATE TABLE tmp.test_table (
      id INT PRIMARY KEY,
      event_time TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6)
    );
    
  2. Insert sample data
    INSERT INTO tmp.test_table VALUES (1, '2025-03-10 00:00:00');
    
  3. Query the table through Gravitino's Trino connector

Additional context

No response

predator4ann avatar Mar 10 '25 09:03 predator4ann