snuyanzin commented on code in PR #26704: URL: https://github.com/apache/flink/pull/26704#discussion_r2157531803
########## 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: not sure if it was missed during PTF implementation will it work with `record` s? Asking since we have a dedicated folder for java17 tests for instance https://github.com/apache/flink/blob/1c34ca011cacdbb3b0f48b485eac89dd913d29bf/flink-tests-java17/src/test/java/org/apache/flink/api/java/typeutils/runtime/PojoRecordSerializerUpgradeTestSpecifications.java -- 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