asolimando commented on code in PR #3858:
URL: https://github.com/apache/calcite/pull/3858#discussion_r1681701865


##########
arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowTranslator.java:
##########
@@ -185,6 +187,34 @@ private String translateOp2(String op, String name, 
RexLiteral right) {
     return name + " " + op + " " + valueString + " " + valueType;
   }
 
+  /** Translates a call to a unary operator. */
+  private String translateUnary(String op, RexCall call) {
+    final RexNode opNode = call.operands.get(0);
+    @Nullable String expression = translateUnary2(op, opNode);
+
+    if (expression != null) {
+      return expression;
+    }
+
+    throw new UnsupportedOperationException("Unsupported unary operator " + 
call);
+  }
+
+  /** Translates a call to a unary operator. Returns null on failure. */
+  private @Nullable String translateUnary2(String op, RexNode opNode) {
+    if (opNode.getKind() == SqlKind.INPUT_REF) {
+      final RexInputRef inputRef = (RexInputRef) opNode;
+      final String name = fieldNames.get(inputRef.getIndex());
+      return translateUnaryOp(op, name);
+    }
+
+    return null;
+  }
+
+  /** Combines a field name and a unary operator to produce a predicate 
string. */
+  private String translateUnaryOp(String op, String name) {

Review Comment:
   Nit: I just noticed this is used in a single place, I guess we can inline as 
it's a single line and the size would be almost the same.



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