rdblue commented on a change in pull request #749: Convert Spark In filter to iceberg IN Expression URL: https://github.com/apache/incubator-iceberg/pull/749#discussion_r371957566
########## File path: spark/src/main/java/org/apache/iceberg/spark/SparkFilters.java ########## @@ -122,11 +122,7 @@ public static Expression convert(Filter filter) { case IN: In inFilter = (In) filter; - Expression in = alwaysFalse(); - for (Object value : inFilter.values()) { - in = or(in, equal(inFilter.attribute(), convertLiteral(value))); - } - return in; + return in(inFilter.attribute(), inFilter.values()); Review comment: @aokolnychyi is right. `null` is never equal to `null`. @jun-he, that's the reason why we shouldn't automatically transform in `Expressions`. By not allowing callers to create predicates like `in(1, null, 2)` we avoid the problem in most Iceberg. We still need to fix the case where Spark passes in `null`, though. I think that Anton is right and we can simply filter `null` out of the list. A null in the list will never cause a value to be accepted. It will only cause the filter to return `null` instead of `false`, which is handled like `false` when filtering: if the filter evaluates to `null` then the row is not selected. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org