rdblue commented on a change in pull request #650: Refactor in and notIn 
expressions
URL: https://github.com/apache/incubator-iceberg/pull/650#discussion_r347164934
 
 

 ##########
 File path: parquet/src/main/java/org/apache/iceberg/parquet/ParquetFilters.java
 ##########
 @@ -113,17 +115,24 @@ protected Expression bind(UnboundPredicate<?> pred) {
     public <T> FilterPredicate predicate(BoundPredicate<T> pred) {
       Operation op = pred.op();
       BoundReference<T> ref = pred.ref();
-      Literal<T> lit = pred.literal();
       String path = schema.idToAlias(ref.fieldId());
+      Literal<T> lit;
+      if (pred.isUnaryPredicate()) {
+        lit = null;
+      } else if (pred.isLiteralPredicate()) {
+        lit = pred.asLiteralPredicate().literal();
+      } else {
+        throw new UnsupportedOperationException("Cannot convert to Parquet 
filter: " + pred);
+      }
 
       switch (ref.type().typeId()) {
         case BOOLEAN:
-          Operators.BooleanColumn col = 
FilterApi.booleanColumn(schema.idToAlias(ref.fieldId()));
+          Operators.BooleanColumn col = FilterApi.booleanColumn(path);
           switch (op) {
             case EQ:
               return FilterApi.eq(col, getParquetPrimitive(lit));
             case NOT_EQ:
-              return FilterApi.eq(col, getParquetPrimitive(lit));
+              return FilterApi.notEq(col, getParquetPrimitive(lit));
 
 Review comment:
   I noticed this bug while updating the conversion.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to