-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[native] Add support for ORC reader #23037
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
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. |
| 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). |
aditi-pandit
left a comment
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 |
@majetideepak : Am a bit conflicted on this. The ORC Reader commit should submit the functional tests that establish the feature I feel. This work takes care of that. If there are specific tests that show issues (like the current Decimal one), then we should disable and fix them individually. |
|
Hi @majetideepak deepak, Do you mean |
majetideepak
left a comment
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.
@wypb, @aditi-pandit I now see that doDeletes got refactored and is not new.
Makes sense to cover all the existing testing for ORC.
I just have one comment.
| testTpcdsQ18(); | ||
| testTpcdsQ19(); | ||
| testTpcdsQ20(); | ||
| // testTpcdsQ21(); |
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.
Do we need to comment here given we have a check inside AbstractTestNativeTpcdsQueries?
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.
+1. Nice catch. Yeah these can be avoided.
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.
@wypb : Seems like there was a misunderstanding about this review comment.
Since testTpcdsQ21 has the following condition
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("33"));
}
then it should pass in runAllQueries. We don't need to comment it in this function. We can uncomment the test call at this point.
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.
Got it, I will refactor the code
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.
@majetideepak @aditi-pandit I have moved runAllQueries() from TestPrestoNativeIcebergTpcdsQueriesOrcUsingThrift.java and TestPrestoNativeIcebergTpcdsQueriesParquetUsingThrift.java to AbstractTestNativeTpcdsQueries.java.
684cdfc to
99f7c7b
Compare
|
@wypb : Thanks for your quick turnaround. Seems like there was a misunderstanding about Deepak's comment. Please fix it. Else this PR is looking good for approval. |
majetideepak
left a comment
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
|
|
||
| * Iceberg connector supports both V1 and V2 tables, including tables with delete files. | ||
|
|
||
| * Supports reading and writing of DWRF and PARQUET file formats, ORC only supports reading. |
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: I think this should say
Supports reading and writing of DWRF and PARQUET file formats, supports reading ORC file format.
CC: @steveburnett
aditi-pandit
left a comment
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
4588dd0 to
b6c744d
Compare
steveburnett
left a comment
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 doc build, looks good. Thanks!
majetideepak
left a comment
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
|
@aditi-pandit do you have any other comments? |
aditi-pandit
left a comment
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
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.