twalthr commented on code in PR #26704:
URL: https://github.com/apache/flink/pull/26704#discussion_r2158202023


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/StructuredFunctionsITCase.java:
##########
@@ -88,14 +97,60 @@ Stream<TestSetSpec> getTestSetSpecs() {
                                 DataTypes.BOOLEAN()));
     }
 
+    private static @NotNull Stream<TestSetSpec> objectOfTestCases() {
+        return Stream.of(
+                TestSetSpec.forFunction(BuiltInFunctionDefinitions.OBJECT_OF)
+                        .onFieldsWithData(42, "Bob")
+                        .andDataTypes(DataTypes.INT(), DataTypes.STRING())
+                        .withFunction(Type1.Type1Constructor.class)
+                        .withFunction(Type2.Type2Constructor.class)
+                        .withFunction(NestedType.NestedConstructor.class)
+                        // Test with OBJECT_OF
+                        .testResult(
+                                objectOf(Type1.class, "a", 42, "b", "Bob"),
+                                "OBJECT_OF('" + Type1.class.getName() + "', 
'a', 42, 'b', 'Bob')",
+                                Row.of(42, "Bob"),
+                                DataTypes.STRUCTURED(
+                                        Type1.class,
+                                        DataTypes.FIELD("a", DataTypes.INT()),
+                                        DataTypes.FIELD("b", 
DataTypes.STRING())))
+                        // Test with same value from function
+                        .testSqlResult(
+                                "Type1Constructor(f0, f1) = OBJECT_OF('"
+                                        + Type1.class.getName()
+                                        + "', 'a', 42, 'b', 'Bob')",
+                                true,
+                                DataTypes.BOOLEAN())
+                        // Test with nested structured types
+                        .testSqlResult(
+                                "NestedConstructor(Type1Constructor(f0, f1), 
Type2Constructor(15, 'Alice')) = "
+                                        + "OBJECT_OF('"
+                                        + NestedType.class.getName()
+                                        + "', 'n1', OBJECT_OF('"
+                                        + Type1.class.getName()
+                                        + "', 'a', 42, 'b', 'Bob'), "
+                                        + "'n2', OBJECT_OF('"
+                                        + Type2.class.getName()
+                                        + "', 'a', 15, 'b', 'Alice'))",

Review Comment:
   Good question. So far we don't have any tests for records because the 
language level was too low.



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to