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_r376681950
########## 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: One other reason we might want to separate their handles: There's already a problem with the (to-be-introduced) state reader / analyzer, that to read a single function's persisted state values, you have to iterate through ALL keys (which includes state of other functions) since we multiplex everything into a single handle. If you multiplex both tables and values into a single state handle, this will because even more of a problem in the future, say when the user just wants to read table state and not value states. ---------------------------------------------------------------- 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