klion26 commented on a change in pull request #11518: [FLINK-16555] Block Enum 
as key type
URL: https://github.com/apache/flink/pull/11518#discussion_r399933141
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
 ##########
 @@ -210,14 +211,15 @@ public KeyedStream(DataStream<T> dataStream, 
KeySelector<T, KEY> keySelector, Ty
         *     the {@link Object#hashCode()} implementation.</li>
         *     <li>it is an array of any type (see {@link 
PrimitiveArrayTypeInfo}, {@link BasicArrayTypeInfo},
         *     {@link ObjectArrayTypeInfo}).</li>
+        *     <li>it is enum type</li>
         * </ol>,
         * {@code true} otherwise.
         */
        private boolean validateKeyTypeIsHashable(TypeInformation<?> type) {
                try {
                        return (type instanceof PojoTypeInfo)
                                        ? 
!type.getTypeClass().getMethod("hashCode").getDeclaringClass().equals(Object.class)
-                                       : !(type instanceof 
PrimitiveArrayTypeInfo || type instanceof BasicArrayTypeInfo || type instanceof 
ObjectArrayTypeInfo);
+                                       : !(type instanceof 
PrimitiveArrayTypeInfo || type instanceof BasicArrayTypeInfo || type instanceof 
ObjectArrayTypeInfo || type instanceof EnumTypeInfo);
 
 Review comment:
   Do we need to extract this logic to a separate function?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to