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


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDataTypesTest.java:
##########
@@ -315,6 +335,252 @@ public void testDecimalLiteral() {
         assertQuery("SELECT id FROM tbl WHERE val = DECIMAL 
'10.20'").returns(1).check();
     }
 
+
+    /** decimal casts - cast literal to decimal. */
+    @ParameterizedTest(name = "{2}:{1} AS {3} = {4}")
+    @MethodSource("decimalCastFromLiterals")
+    public void testDecimalCastsNumericLiterals(CaseStatus status, RelDataType 
inputType, Object input,
+            RelDataType targetType, Result<BigDecimal> result) {
+
+        Assumptions.assumeTrue(status == CaseStatus.RUN);
+
+        String literal = asLiteral(input, inputType);
+        String query = format("SELECT CAST({} AS {})", literal, targetType);
+
+        QueryChecker checker = assertQuery(query);
+        expectResult(checker, result);
+    }
+
+    private static Stream<Arguments> decimalCastFromLiterals() {
+        RelDataType varcharType = varcharType();
+        // ignored
+        RelDataType numeric = decimalType(4);
+
+        return Stream.of(
+                // String
+                arguments(CaseStatus.RUN, varcharType, "100", decimalType(3), 
bigDecimalVal("100")),

Review Comment:
   @zstan Added these cases.



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