-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Various precision for Oracle timestamp #17934
Various precision for Oracle timestamp #17934
Conversation
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Outdated
Show resolved
Hide resolved
a0ea050
to
af691c3
Compare
@@ -482,6 +491,14 @@ else if (precision > Decimals.MAX_PRECISION || actualPrecision <= 0) { | |||
DISABLE_PUSHDOWN)); | |||
|
|||
case OracleTypes.TIMESTAMP: | |||
// nano precision | |||
if (typeHandle.getDecimalDigits().isPresent() && typeHandle.getDecimalDigits().get() == 9) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does oracle supports only nano precision or can it be between 0
and 6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oracle supports as far as I see any precision from 0 to 9.
In trino for oracle as default we have milis (3).
But we could add also micros in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we file an issue and leave TODO comment? Special handling only for nano precision is weird to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it not possible to do what we do in SQLServer for example where we map a timestamp(p)
from SQL Server to matching timestamp(p)
in Trino.
This change means Oracle connector would either use NANOS or MILLIS, no other precisions even though they seem technically possible to implement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will try to generify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
af691c3
to
3f65da2
Compare
3f65da2
to
b3b6919
Compare
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Show resolved
Hide resolved
} | ||
|
||
@Test | ||
public void testTimestampNanosBeyondPrecision() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add another test method verifying failure when writing min - 1 & max + 1?
@@ -482,6 +491,14 @@ else if (precision > Decimals.MAX_PRECISION || actualPrecision <= 0) { | |||
DISABLE_PUSHDOWN)); | |||
|
|||
case OracleTypes.TIMESTAMP: | |||
// nano precision | |||
if (typeHandle.getDecimalDigits().isPresent() && typeHandle.getDecimalDigits().get() == 9) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we file an issue and leave TODO comment? Special handling only for nano precision is weird to me.
b3b6919
to
e7d1d00
Compare
Refactored to any precision support |
5898964
to
844e5f3
Compare
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Show resolved
Hide resolved
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
8a96cd0
to
5c998d4
Compare
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
5c998d4
to
1ac5783
Compare
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Show resolved
Hide resolved
1ac5783
to
36ffbb2
Compare
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Show resolved
Hide resolved
6049aa7
to
2e8575d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes.
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Outdated
Show resolved
Hide resolved
2e8575d
to
29f33fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. few nit comments.
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/BaseOracleConnectorTest.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/BaseOracleConnectorTest.java
Outdated
Show resolved
Hide resolved
if (timestampType.isShort()) { | ||
return WriteMapping.longMapping(dataType, oracleTimestampWriteFunction(timestampType)); | ||
} | ||
return WriteMapping.objectMapping(dataType, oracleLongTimestampWriteFunction(createTimestampType(precision))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling createTimestampType
looks redundant to me. oracleLongTimestampWriteFunction
uses only precision
. Same for oracleTimestampWriteFunction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to be consistent with oracleLongTimestampReadFunction
which requires timestampType or need to refactor toTrinoTimestamp
from base-jdbc
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Show resolved
Hide resolved
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Outdated
Show resolved
Hide resolved
29f33fb
to
bc2305e
Compare
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Outdated
Show resolved
Hide resolved
6e9a7f3
to
3bfc4bf
Compare
We can use any presicion for oracle timestamp(p), p could be in range from 0 to 9.
3bfc4bf
to
845b488
Compare
@vlad-lyutenko Can you update the release notes description |
Thanks for working on this. |
Description
Additional context and related issues
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text:
Now we can use any presicion for oracle timestamp(p),
p could be in range from 0 to 9.