aljoscha commented on a change in pull request #11145: 
[FLINK-15904][connectors/kafka] Make Kafka Consumer work with activated 
"disableGenericTypes()"
URL: https://github.com/apache/flink/pull/11145#discussion_r381410931
 
 

 ##########
 File path: 
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBase.java
 ##########
 @@ -857,9 +860,16 @@ public final void 
initializeState(FunctionInitializationContext context) throws
                ListState<Tuple2<KafkaTopicPartition, Long>> 
oldRoundRobinListState =
                        
stateStore.getSerializableListState(DefaultOperatorStateBackend.DEFAULT_OPERATOR_STATE_NAME);
 
-               this.unionOffsetStates = stateStore.getUnionListState(new 
ListStateDescriptor<>(
-                               OFFSETS_STATE_NAME,
-                               TypeInformation.of(new 
TypeHint<Tuple2<KafkaTopicPartition, Long>>() {})));
+               TypeSerializer<?>[] fieldSerializers = new TypeSerializer<?>[]{
+                       new KryoSerializer<>(KafkaTopicPartition.class, 
getRuntimeContext().getExecutionConfig()),
+                       LongValueSerializer.INSTANCE
+               };
+               @SuppressWarnings("unchecked")
+               Class<Tuple2<KafkaTopicPartition, Long>> tupleClass = 
(Class<Tuple2<KafkaTopicPartition, Long>>) (Class<?>) Tuple2.class;
+               TupleSerializer<Tuple2<KafkaTopicPartition, Long>> 
unionOffsetStatesSerDe = new TupleSerializer<>(tupleClass,
 
 Review comment:
   We should add a comment about why we're doing it like this. (And 
`stateSerializer` is probably better as a variable name here.)

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to