lowka commented on code in PR #4478:
URL: https://github.com/apache/ignite-3/pull/4478#discussion_r1793525261


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java:
##########
@@ -3077,6 +3077,16 @@ private static class BinaryImplementor extends 
AbstractRexCallImplementor {
         argValueList = FlatLists.append(argValueList, fieldComparator);
       }
 
+      if (type0 == BigDecimal.class && type1 == BigDecimal.class && op == 
DIVIDE) {

Review Comment:
   @korlov42 I definitely works. 
   
   I have updated `genValueStatement` in `RexImpTable` with the following code
   
   ```
     private static String exprToString(List<Expression> exprs) {
         return exprs.stream()
                 .map(e -> e.getType() + " >>" + e + "<<")
                 .collect(Collectors.joining());
       }
       
      private ParameterExpression genValueStatement(
         ..
       if (harmonize) {
           System.err.println("HARMONIZE " + call + " " + 
exprToString(optimizedArgValueList));
           optimizedArgValueList =
               harmonize(optimizedArgValueList, translator, call);
           System.err.println("HARMONIZE " + call + " RESULT " + 
exprToString(optimizedArgValueList));
         }
   ```
   
   When I run the following code:
   ```
   @Test
       public void test() {
           sql("CREATE TABLE t(id INT PRIMARY KEY, int_col INT, decimal_col 
DECIMAL(3,1) )");
   
           sql("INSERT INTO t VALUES (1, 2, 2.1)");
   
           sql("SELECT int_col / decimal_col FROM t");
       }
   ```
   I see 
   
   ```
   HARMONIZE /($t0, $t1) class java.lang.Integer >>input_value<<class 
java.math.BigDecimal >>input_value0<<
   HARMONIZE /($t0, $t1) RESULT class java.math.BigDecimal >>input_value == 
null ? (java.math.BigDecimal) null : new java.math.BigDecimal(
     input_value.intValue())<<class java.math.BigDecimal >>input_value0<<
   ```
   int, big decimal becomes big decimal, big decimal.
   



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to