Skip to content

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

Open
@predator4ann

Description

@predator4ann

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

Metadata

Metadata

Assignees

Labels

0.9.0Release v0.9.0bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions