-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redshift connector cannot read timestamp columns in >v341 #6607
Comments
There is lack of rounding in the default column mapping being returned here trino/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/StandardColumnMappings.java Line 577 in 03d8e5a
which is trino/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/StandardColumnMappings.java Lines 492 to 498 in 03d8e5a
The code went in 342. |
@findepi when you say "silently leading to incorrect query results" do you mean "silently rounding the precision of the timestamp" or do you mean "completely wrong timestamp values". Just trying to grasp the severity of the bug. |
@grantatspothero for just SELECT queries it was returning correct results |
Closing as #15365 |
Querying columns of type
timestamp
fails in trino versions >v345.with the stacktrace:
I think this is because the redshift connector uses the basejdbc connector, which maps the
timestamp
redshift type to theTIMESTAMP_MILLIS
trino timestamp type. However, the redshifttimestamp
type has 6 digits of precision (not the 3 trino is expecting).trino/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/StandardColumnMappings.java
Lines 575 to 577 in 2bcf5d9
https://docs.aws.amazon.com/redshift/latest/dg/r_Datetime_types.html#r_Datetime_types-timestamp
This started causing queries to fail in v346 when this PR was introduced: #5742 Previously
SqlTimestamp. newInstance
would round the timestamp when the precision did not match the expected precision, now it explicitly fails.I think the fix should just be overriding
toColumnMapping
in the redshift client to handle timestamps with 6 digits of precision.See this thread for context:
https://trinodb.slack.com/archives/CGB0QHWSW/p1610645172011400
The text was updated successfully, but these errors were encountered: