rdblue commented on a change in pull request #1747:
URL: https://github.com/apache/iceberg/pull/1747#discussion_r529020078
##########
File path:
parquet/src/main/java/org/apache/iceberg/parquet/ParquetDictionaryRowGroupFilter.java
##########
@@ -148,6 +150,39 @@ public Boolean or(Boolean leftResult, Boolean rightResult)
{
return ROWS_MIGHT_MATCH;
}
+ @Override
+ public <T> Boolean isNaN(BoundReference<T> ref) {
+ int id = ref.fieldId();
+
+ Boolean hasNonDictPage = isFallback.get(id);
+ if (hasNonDictPage == null || hasNonDictPage) {
+ return ROWS_MIGHT_MATCH;
+ }
+
+ Set<T> dictionary = dict(id, comparatorForNaNPredicate(ref));
+ return dictionary.stream().anyMatch(NaNUtil::isNaN) ? ROWS_MIGHT_MATCH :
ROWS_CANNOT_MATCH;
+ }
+
+ @Override
+ public <T> Boolean notNaN(BoundReference<T> ref) {
+ int id = ref.fieldId();
+
+ Boolean hasNonDictPage = isFallback.get(id);
+ if (hasNonDictPage == null || hasNonDictPage) {
+ return ROWS_MIGHT_MATCH;
+ }
+
+ Set<T> dictionary = dict(id, comparatorForNaNPredicate(ref));
+ return dictionary.stream().allMatch(NaNUtil::isNaN) ? ROWS_CANNOT_MATCH
: ROWS_MIGHT_MATCH;
+ }
+
+ private <T> Comparator<T> comparatorForNaNPredicate(BoundReference<T> ref)
{
Review comment:
You can also use `Comparators.forType`. The dictionary cannot contain
null values so there is no need to wrap for null handling.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]