-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[native] Add support for ORC reader #23037
base: master
Are you sure you want to change the base?
Conversation
55a8d5b
to
7325337
Compare
Hi @majetideepak @aditi-pandit could you please help review this PR? Thanks! |
@wypb can you add some end-to-end tests? Thanks! |
@wypb : Would be great to use ORC with the QueryRunners (https://github.com/prestodb/presto/blob/master/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/PrestoNativeQueryRunnerUtils.java) in an e2e test. The test should highlight differences of ORC wrt Parquet, demonstrate filter pushdown as well. Using ORC with Hive and as a format with Iceberg is perfect. |
Hi @majetideepak @aditi-pandit I added TPCH tests for ORC, including the Iceberg data source. The TPCDS test for ORC is not added because some types of Velox's ORC reader currently do not implement fast path, which will cause exceptions when reading data.
|
@wypb : Your code looks fine. When I search for ORC in the presto-native-execution directory I also see the following usage. https://github.com/prestodb/presto/blob/master/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestWriter.java#L71 needs a fix as well Please can you check about it. |
0d3570c
to
9615017
Compare
Good catch, thank you @aditi-pandit I've fixed it. |
@aditi-pandit I looked at the code again and found that this should not be removed. |
@@ -73,6 +73,7 @@ private static void createTpcdsCallCenter(QueryRunner queryRunner, Session sessi | |||
if (!queryRunner.tableExists(session, "call_center")) { | |||
switch (storageFormat) { | |||
case "PARQUET": | |||
case "ORC": |
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.
As per https://orc.apache.org/docs/types.html ORC supports DATE type. The DWRF reader doesn't support DATE as a first-class and so we coerced all those columns to VARCHAR in tests. Do you have a plan for those ?
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.
DWRF does not support the DATE type, but Velox queries ORC's DATE type using SelectiveIntegerDirectColumnReader. My test shows that the DATE type data can be read correctly. So I don't think it is necessary to convert the DATE type to VARCHAR.
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.
I recently added a parameter to createAllTables to not do the DATE -> VARCHAR casting for TPCH tables https://github.com/prestodb/presto/blob/master/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/NativeQueryRunnerUtils.java#L69. You can use it in your tests.
@wypb : Had a question about this point you raised... You are saying that HiveQueryRunner can't read TPC-DS tables, but handles. That seems odd. Did you look deeper into what TPC-H is doing different ? The main difference is that in TPC-H all date columns were exposed as VARCHAR. But wonder if there is anything else ? Would be great to see which particular column here is problematic. |
@wypb is this PR still being worked on? |
Hi @tdcmeehan sorry for the late reply. Yes, I'm still keeping an eye on this. I've been working on a few Velox PRs lately, so I haven't had time to work on this yet. I'll update this PR later this week. |
Let's add ORC as a supported file format in Supported Use Cases (we can also mention that Parquet is a supported format). |
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.
Thanks @wypb. Have a question:
As per https://orc.apache.org/docs/types.html ORC supports DATE type. The DWRF reader doesn't support DATE as a first-class and so we coerced all those columns to VARCHAR in tests. Do you have a plan for those ?
@Override | ||
protected ExpectedQueryRunner createExpectedQueryRunner() throws Exception | ||
{ | ||
this.storageFormat = "ORC"; |
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.
Since this is a member variable and the same value used in all methods, you can initialize it at the class level outside the methods and use this.storageFormat each place.
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.
Already refactored, thank you.
Should this be mentioned in the doc, maybe in Supported Use Cases or Presto C++ Features? |
Hi @tdcmeehan, @aditi-pandit sorry for the late reply.
I was also curious about this question before, but I didn't check the reason. Today I checked why most of the TPCDS queries failed, while all the TPCH queries passed. I debugged the code and found that the integer fields of the TPCDS table (such as the For related code, see
For the TPCH table,
If we modify the implementation of
|
DWRF does not support the DATE type, but Velox queries ORC's DATE type using |
bbd98a9
to
de8b7eb
Compare
Hi @tdcmeehan @steveburnett I have added relevant documents in Supported Use Cases, please help me review it, thank you. |
4223823
to
720471b
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.
Nit of a phrasing suggestion.
@wypb : Thanks. This is a good find. Would be great to follow up the Velox change and then submit this PR as having the NULL values should be a common use-case. |
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! (docs)
Pull updated branch, new local docs build, looks good. Thanks!
Hi @aditi-pandit I have submitted a PR to Velox, please help me review it, thank you. |
Summary: As discussed in prestodb/presto#23037 (comment), we need to disable fastpath reads of some ORC data types, so that we can add TPCDS related tests in the Presto native module. CC: Yuhta aditi-pandit Pull Request resolved: #10939 Reviewed By: Yuhta Differential Revision: D62373833 Pulled By: mbasmanova fbshipit-source-id: f38c7959ffb72c1ecbda9c7de4631dfa5ee73e39
…r#10939) Summary: As discussed in prestodb/presto#23037 (comment), we need to disable fastpath reads of some ORC data types, so that we can add TPCDS related tests in the Presto native module. CC: Yuhta aditi-pandit Pull Request resolved: facebookincubator#10939 Reviewed By: Yuhta Differential Revision: D62373833 Pulled By: mbasmanova fbshipit-source-id: f38c7959ffb72c1ecbda9c7de4631dfa5ee73e39
@ethanyzhang imported this issue into IBM GitHub Enterprise |
@wypb : The Velox PR is submit. Any chance you can rebase your code ? Let's try to wind up this PR. |
Description
We have recently merged the PR for reading ORC statistics and implementing OrcReader based on DwrfReader on the velox side. Now it is time to add support for ORC reader it in Prestissimo.
NOTE: Because Presto uses RLEv2 encoding to write ORC files, and some types of Velox ORC readers do not implement fast path readers, which will cause exceptions when Velox reads ORC, so end-to-end tests for TPCDS in ORC are not added here. Once Velox implements fast path readers for ORC RLEv2 encoding, we need to add ORC tests.