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_r376682205
########## 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: Some more food for thought: If we do decide to separate the handles, we can slim down the `MultiplexedStateKey` type a bit, by having a separate `MultiplexedTableStateKey` that has a `ByteString userKey` field and a `MultiplexedStateKey prefix` field. For example, I already have a minor concern with the way we use `MultiplexedStateKey`: Does protobuf repeated fields require some extra metadata written? If yes, its a tad bit redundant size-wise in this case since we only ever have 1 user key added. ---------------------------------------------------------------- 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