klion26 commented on a change in pull request #8122: [FLINK-12121] [State 
Backends] Use composition instead of inheritance for the InternalKeyContext 
logic in backend
URL: https://github.com/apache/flink/pull/8122#discussion_r273297318
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/state/AbstractKeyedStateBackend.java
 ##########
 @@ -94,52 +89,55 @@
        /** Decorates the input and output streams to write key-groups 
compressed. */
        protected final StreamCompressionDecorator keyGroupCompressionDecorator;
 
+       /** The key context for this backend. */
+       protected final InternalKeyContext<K> keyContext;
+
        public AbstractKeyedStateBackend(
                TaskKvStateRegistry kvStateRegistry,
                TypeSerializer<K> keySerializer,
                ClassLoader userCodeClassLoader,
-               int numberOfKeyGroups,
-               KeyGroupRange keyGroupRange,
                ExecutionConfig executionConfig,
                TtlTimeProvider ttlTimeProvider,
-               CloseableRegistry cancelStreamRegistry) {
+               CloseableRegistry cancelStreamRegistry,
+               InternalKeyContext<K> keyContext) {
                this(
                        kvStateRegistry,
                        
StateSerializerProvider.fromNewRegisteredSerializer(keySerializer),
                        userCodeClassLoader,
-                       numberOfKeyGroups,
-                       keyGroupRange,
                        executionConfig,
                        ttlTimeProvider,
                        cancelStreamRegistry,
-                       determineStreamCompression(executionConfig)
+                       determineStreamCompression(executionConfig),
+                       keyContext
                );
        }
 
        public AbstractKeyedStateBackend(
                TaskKvStateRegistry kvStateRegistry,
                StateSerializerProvider<K> keySerializerProvider,
                ClassLoader userCodeClassLoader,
-               int numberOfKeyGroups,
-               KeyGroupRange keyGroupRange,
                ExecutionConfig executionConfig,
                TtlTimeProvider ttlTimeProvider,
                CloseableRegistry cancelStreamRegistry,
-               StreamCompressionDecorator keyGroupCompressionDecorator) {
+               StreamCompressionDecorator keyGroupCompressionDecorator,
+               InternalKeyContext<K> keyContext) {
+               Preconditions.checkNotNull(keyContext);
 
 Review comment:
   Do we need to add `checkNotNull(keyGroupCompressionDecorator)` 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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to