You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/03/08 09:24:50 UTC

[GitHub] [incubator-iceberg] fbocse commented on a change in pull request #123: Add support for struct field based filtering

fbocse commented on a change in pull request #123: Add support for struct field based filtering
URL: https://github.com/apache/incubator-iceberg/pull/123#discussion_r263708990
 
 

 ##########
 File path: api/src/main/java/com/netflix/iceberg/expressions/UnboundPredicate.java
 ##########
 @@ -67,11 +68,13 @@ Expression bind(Types.StructType struct) {
    */
   public Expression bind(Types.StructType struct, boolean caseSensitive) {
     Types.NestedField field;
-    if (caseSensitive) {
-      field = struct.field(ref().name());
-    } else {
-      field = struct.caseInsensitiveField(ref().name());
-    }
+    String expressionFieldPath = ref().name();
+
+    boolean isStructFieldExp = expressionFieldPath.indexOf('.') > -1 &&
+      struct.field(expressionFieldPath.split("\\.")[0]).type() instanceof Types.StructType;
 
 Review comment:
   Nit: in terms of where we want to put in the constraint of filtering only against struct types, I'm wondering if it'd make sense to only code this aspect in the private `findStructField` method.  
   
   We'd only have `bind` delegate to `findStructField` (findNestedField ?)  in the case that the `expressionFieldPath` contains nested fields only so we'd simplify the condition as `boolean isFieldExp = expressionFieldPath.indexOf('.') > -1`.
   
   I'm thinking that if we may end up adding support for other nested types (i.e. map) we'd make changes only to the `findStructField` implementation without having to change the internals of `bind` to delegate to a potential private method `findMapField` and adding cyclomatic complexity to evaluating the `field` attribute.
   
   Wdyt?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org