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


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/DynamicParametersTest.java:
##########
@@ -44,6 +52,41 @@ public void testInferencePreservesNullability() throws 
Throwable {
                 .getExecutable().execute();
     }
 
+    @ParameterizedTest(name = "type=" + ARGUMENTS_PLACEHOLDER)
+    @MethodSource("oneColumnParameters")
+    public void testAllowedCasts(NativeTypeSpec type) throws Throwable {
+        String typeName = sqlTypeName(type);
+
+        // custom type.
+        UUID uuid = UUID.randomUUID();
+        if (type != NativeTypeSpec.UUID) {
+            sql(String.format("SELECT CAST(? AS %s)", typeName), 
uuid).fails("Cast function cannot convert value of type")
+                    .getExecutable().execute();
+            // TODO: unmute after 
https://issues.apache.org/jira/browse/IGNITE-20069
+            /*sql(String.format("SELECT CAST('%s' AS %s)", uuid, typeName), 
uuid).fails("Cast function cannot convert value of type")
+                    .getExecutable().execute();*/
+        } else {
+            sql(String.format("SELECT CAST(? AS %s)", typeName), 
uuid).ok().getExecutable().execute();
+        }
+
+        LocalTime now = LocalTime.now();
+        if (type != NativeTypeSpec.TIME) {
+            sql(String.format("SELECT CAST(? AS %s)", typeName), 
now).fails("Cast function cannot convert value of type")
+                    .getExecutable().execute();
+            // TODO: unmute after 
https://issues.apache.org/jira/browse/IGNITE-20069
+            /*sql(String.format("SELECT CAST(time '02:30:00' AS %s)", 
typeName)).fails("Cast function cannot convert value of type")
+                    .getExecutable().execute();*/
+        } else {
+            sql(String.format("SELECT CAST(? AS %s)", typeName), now).ok()
+                    .getExecutable().execute();
+        }
+
+        // not supported type.
+        Object custom = new Object();
+        sql(String.format("SELECT CAST(? AS %s)", typeName), 
custom).fails("Cast function cannot convert value of type")

Review Comment:
   You can replace .getExecutable().execute();
   with 
   >Stream.of(
   > sql(...).check(),
   > sql(...).check(),
   >)
   + Change `testAllowedCasts` to return `Stream<DynamicTest>`
   After that each test case runs separately.
   



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