tzulitai commented on a change in pull request #17: [FLINK-15954] Add a 
PersistedTable to the SDK
URL: https://github.com/apache/flink-statefun/pull/17#discussion_r376681673
 
 

 ##########
 File path: 
statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/state/MultiplexedState.java
 ##########
 @@ -65,6 +67,19 @@ public MultiplexedState(
     return new MultiplexedMapStateAccessor<>(sharedMapStateHandle, 
uniqueSubKey, valueSerializer);
   }
 
+  @Override
+  public <K, V> TableAccessor<K, V> createFlinkStateTableAccessor(
+      FunctionType functionType, PersistedTable<K, V> persistedTable) {
+    final MultiplexedStateKey uniqueSubKeyPrefix =
+        multiplexedSubstateKey(functionType, persistedTable.name());
+    final TypeSerializer<K> keySerializer =
+        
types.registerType(persistedTable.keyType()).createSerializer(executionConfiguration);
+    final TypeSerializer<V> valueSerializer =
+        
types.registerType(persistedTable.valueType()).createSerializer(executionConfiguration);
+    return new MultiplexedTableStateAccessor<>(
+        sharedMapStateHandle, uniqueSubKeyPrefix, keySerializer, 
valueSerializer);
 
 Review comment:
   What is the benefit of multiplexing both `PersistedValue`s and 
`PersistedTable`s within the same Flink `MapState`?
   While I can't really think of a disadvantage of doing this, my gut feeling 
is that it'll be more future proof to have them separated, i.e. one `MapState` 
for multiplexing value states, and another one for multiplexing table states.
   
   WDYT?

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