-
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
Map Oracle date to Trino timestamp(0) type #10638
Conversation
Unfortunately, it's little hard to verify the Oracle execution plan on CI at this time. Here is the manual comparison results: Create index on TPCH orders.orderdate column. CREATE INDEX trino_test_orders ON trino_test.orders (orderdate); TO_TIMESTAMP function EXPlAIN PLAN FOR SELECT * FROM trino_test.orders WHERE orderdate > TO_TIMESTAMP('2011-01-01 01:01:01.11"', 'SYYYY-MM-DD HH24:MI:SS.FF');
SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
Plan hash value: 1275100350
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 779 | 214K| 70 (3)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| ORDERS | 779 | 214K| 70 (3)| 00:00:01 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(INTERNAL_FUNCTION("ORDERDATE")>TO_TIMESTAMP('2011-01-01
01:01:01.11"','SYYYY-MM-DD HH24:MI:SS.FF'))
Note
-----
- dynamic sampling used for this statement (level=2) TO_DATE function EXPlAIN PLAN FOR SELECT * FROM trino_test.orders WHERE orderdate > TO_DATE('2011-01-01 01:01:01.11"', 'SYYYY-MM-DD HH24:MI:SS.FF');
SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
Plan hash value: 1158690668
-------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 997 | 274K| 67 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| ORDERS | 997 | 274K| 67 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | TRINO_TEST_ORDERS | 179 | | 2 (0)| 00:00:01 |
-------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("ORDERDATE">TO_DATE('2011-01-01 01:01:01.11"','SYYYY-MM-DD HH24:MI:SS.FF')) |
2810889
to
ae6fb17
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
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
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
Show resolved
Hide resolved
@hashhar ptal |
@hashhar Gentler reminder. I would like to include this PR into 369 because it's kind of regression in 368. |
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.
Some comments. Looks good overall.
Will this break any views people have created using Hive connector over Oracle tables?
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
Show resolved
Hide resolved
plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java
Show resolved
Hide resolved
This change fixes peformance regression due to 77cfd97. TO_TIMESTAMP function with date column led to full scan in Oracle side when it's indexed column.
d7cfac6
to
2421203
Compare
It won't break existing views. The original column definition |
Fixes #10626