dylanhz commented on code in PR #29133:
URL: https://github.com/apache/flink/pull/29133#discussion_r4001918601


##########
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java:
##########
@@ -836,6 +837,31 @@ public Long reduce(Long value1, Long value2) throws 
Exception {
                 .isEqualTo(preferredResource7);
     }
 
+    @Test
+    void testMapWithExplicitUuidType() {
+        final StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+        // A lambda would bypass the input validation exercised by this test.
+        final MapFunction<UUID, String> mapper =
+                new MapFunction<UUID, String>() {
+                    @Override
+                    public String map(UUID value) {
+                        return value.toString();
+                    }
+                };

Review Comment:
   UUID → byte[] seems to exercise the same input validation as UUID → String, 
while String → UUID covers output extraction. Is there a specific scenario 
you’d like these tests to cover?



##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java:
##########
@@ -1498,10 +1499,16 @@ private static void validateInfo(
             // check for Java Basic Types
             if (typeInfo instanceof BasicTypeInfo) {
 
-                TypeInformation<?> actual;
                 // check if basic type at all
-                if (!(type instanceof Class<?>)
-                        || (actual = BasicTypeInfo.getInfoFor((Class<?>) 
type)) == null) {
+                if (!(type instanceof Class<?>)) {
+                    throw new InvalidTypesException("Basic type expected.");
+                }
+                // UUID is not registered for automatic extraction to preserve 
existing serializers.
+                final TypeInformation<?> actual =
+                        type == UUID.class
+                                ? BasicTypeInfo.UUID_TYPE_INFO
+                                : BasicTypeInfo.getInfoFor((Class<?>) type);

Review Comment:
   Agreed. Moved both tests to `TypeExtractorTest`.



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