zstan commented on code in PR #4422:
URL: https://github.com/apache/ignite-3/pull/4422#discussion_r1773297938


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeSystemTest.java:
##########
@@ -168,5 +169,126 @@ private static Stream<Arguments> deriveAvgTypeArguments() 
{
                         native2relationalType(typeFactory, NativeTypes.DOUBLE)
                 )
         );
-    } 
+    }
+
+    @ParameterizedTest(name = "op={0} {3} {1}")
+    @MethodSource("deriveTypeArguments")
+    void deriveType(NativeType type1, NativeType type2, NativeType expected, 
ArithmeticOp op) {
+        RelDataType relType1 = native2relationalType(Commons.typeFactory(), 
type1);
+        RelDataType relType2 = native2relationalType(Commons.typeFactory(), 
type2);
+        RelDataType relExpected = native2relationalType(Commons.typeFactory(), 
expected);
+
+        switch (op) {
+            case DIV: {
+                RelDataType actual = 
typeSystem.deriveDecimalDivideType(Commons.typeFactory(), relType1, relType2);
+                assertThat(actual, Matchers.equalTo(relExpected));
+                break;
+            }
+            case MULT: {
+                RelDataType actual = 
typeSystem.deriveDecimalMultiplyType(Commons.typeFactory(), relType1, relType2);
+                assertThat(actual, Matchers.equalTo(relExpected));
+                break;
+            }
+            case ADD: {
+                RelDataType actual = 
typeSystem.deriveDecimalPlusType(Commons.typeFactory(), relType1, relType2);
+                assertThat(actual, Matchers.equalTo(relExpected));
+                break;
+            }
+            default:
+                throw new IllegalArgumentException("Unexpected operation type: 
" + op);
+        }

Review Comment:
   done



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