-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Parquet: Support In predicate pushdown for ParquetFilters
#14041
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
Parquet: Support In predicate pushdown for ParquetFilters
#14041
Conversation
in predicate pushdown for ParquetFiltersIn predicate pushdown for ParquetFilters
|
Any suggestion of how this should be tested would be appreciated. Currently I don't see any test for the class |
RussellSpitzer
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.
This looks generally good to me but I'm wondering if we have adequate test coverage for the feature? Do we have tests that are using the IN predicate already that cover this?
| @SuppressWarnings("checkstyle:MethodTypeParameterName") | ||
| private static <C extends Comparable<C>, COL extends Operators.Column<C> & Operators.SupportsLtGt> | ||
| FilterPredicate pred(Operation op, COL col, C value) { | ||
| FilterPredicate pred(Operation op, COL col, C value, Set<C> valueSet) { |
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.
Is this how this is handled in Spark? I may be in the minority here but I would prefer two different pred functions, one which uses Set and the other using C. Then only calling the one which is appropriate based on usage rather than having both arguments and using different args based on the predicate type.
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.
Spark handles predicate pushdown in a more verbose way, basically:
predicate match {
case OP1:
parquetType match {
case TYPE1: FilterApi.op1()
case TYPE2: FilterApi.op1()
...
}
case OP2:
parquetType match {
case TYPE1: FilterApi.op2()
case TYPE2: FilterApi.op2()
...
}
...
}
While Iceberg handles this more compactly. It already handles unary predicate and literal predicate in the same pred function. I wouldn't mind adding a new pred function, but it seems we already use different args (no arg or C) based on predicate type in pred.
I think this is always used via Parquet.java
So I think almost all of our current coverage is downstream of actual implementations using Parquet.read.filter() which is a problem. So Theoretically and test with an IN clause in it for any engine should hit this but I feel like we should probably have some explicit unit tests of this? |
It seems the existing tests using IN predicate are from row group filters:
Iceberg currently lacks support for page skipping, thus the pushed Parquet filter actually does not help filtering records inside a row group IIUC. A working test case for predicate pushdown can be added along with page skipping feature, similar to https://github.com/apache/iceberg/pull/10228/files#diff-2fc3ebd599749d66bd75f9eb14e030aa97f2fc09e775d7ba372e73f46db25da8. |
Sounds good. I'll add explicit unit tests for |
| } | ||
|
|
||
| // TODO: this needs to convert to handle BigDecimal and UUID | ||
| Set<C> convertedSet = Sets.newHashSet(); |
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.
if we add everything from litSet to convertedSet, should we initialize it with the size parameter as Sets.newHashSet(litSet); It would be more efficient.
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
Inpredicate support was added to Parquet FilterApi via apache/parquet-java#923.This PR adds
Inpredicate support to IcebergParquetFilters, so that we can use Parquet nativeInpredicate support for filters. This will be useful for page skipping feature as continuation work of #10228 and #10399.As reference, support of native
Inpredicate was added to Spark parquet reader in apache/spark#36696.