mihaibudiu commented on code in PR #4848:
URL: https://github.com/apache/calcite/pull/4848#discussion_r3002620224


##########
arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowTranslator.java:
##########
@@ -61,13 +63,24 @@ public static ArrowTranslator create(RexBuilder rexBuilder,
     return new ArrowTranslator(rexBuilder, rowType);
   }
 
-  List<String> translateMatch(RexNode condition) {
-    List<RexNode> disjunctions = RelOptUtil.disjunctions(condition);
-    if (disjunctions.size() == 1) {
-      return translateAnd(disjunctions.get(0));
-    } else {
-      throw new UnsupportedOperationException("Unsupported disjunctive 
condition " + condition);
+  /** The maximum number of nodes allowed during CNF conversion.
+   * If exceeded, the original expression is returned unchanged. */

Review Comment:
   what happens to the translation in that case? It fails?



##########
arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowRel.java:
##########
@@ -41,15 +41,15 @@ public interface ArrowRel extends RelNode {
    * {@link ArrowRel} nodes into a SQL query. */
   class Implementor {
     @Nullable List<Integer> selectFields;
-    final List<String> whereClause = new ArrayList<>();
+    final List<List<List<String>>> whereClause = new ArrayList<>();
     @Nullable RelOptTable table;
     @Nullable ArrowTable arrowTable;
 
     /** Adds new predicates.
      *
-     * @param predicates Predicates
+     * @param predicates Predicates in CNF form (outer list is AND, inner list 
is OR)

Review Comment:
   I see 3 lists, can you explain all of them?



##########
arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowTable.java:
##########
@@ -184,6 +178,43 @@ private static RelDataType deduceRowType(Schema schema,
     return builder.build();
   }
 
+  /** Parses a single condition into a Gandiva {@link TreeNode}.
+   *
+   * <p>The condition token format is:
+   * <ul>
+   *   <li>Binary: {@code [fieldName, operator, value, type]},
+   *       e.g. {@code ["intField", "equal", "12", "integer"]}</li>
+   *   <li>Unary: {@code [fieldName, operator]},
+   *       e.g. {@code ["intField", "isnull"]}</li>
+   * </ul>
+   *
+   * <p>Using structured tokens avoids string splitting and safely supports

Review Comment:
   There is no need to justify this choice.
   In general, you should use higher-level representations as much as possible.



##########
arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowTable.java:
##########
@@ -184,6 +178,43 @@ private static RelDataType deduceRowType(Schema schema,
     return builder.build();
   }
 
+  /** Parses a single condition into a Gandiva {@link TreeNode}.

Review Comment:
   It looks to me that it would be better to define a new class for this data 
structure UnaryOrBinaryCondition perhaps, instead of using a List<String>.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to