caicancai commented on code in PR #4031:
URL: https://github.com/apache/calcite/pull/4031#discussion_r1828625827


##########
arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowTranslator.java:
##########
@@ -170,11 +170,47 @@ private String translateBinary(String op, String rop, 
RexCall call) {
     case CAST:
       // FIXME This will not work in all cases (for example, we ignore string 
encoding)
       return translateBinary2(op, ((RexCall) left).operands.get(0), right);
+    case PLUS:
+    case MINUS:
+      right = translateArithmeticOp(left, right);
+      return translateBinary2(op, ((RexCall) left).operands.get(0), right);
     default:
       return null;
     }
   }
 
+  /**
+   * Translates a call to an arithmetic operator.
+   * This method handles arithmetic operations like addition and subtraction
+   * between literals and adjusts the right operand accordingly.
+   *
+   * @param left The left operand, which is an arithmetic operation
+   * @param right The right operand, which is a literal
+   * @return A new RexNode representing the adjusted right operand
+   */
+  private RexNode translateArithmeticOp(RexNode left, RexNode right) {
+    RexNode leftOperand = ((RexCall) left).operands.get(1);

Review Comment:
   I'm not sure if it works, and it seems no one has tried it yet.



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