Bowen Li created FLINK-8365: ------------------------------- Summary: Consider relax List type in HeapListState and HeapKeyedStateBackend Key: FLINK-8365 URL: https://issues.apache.org/jira/browse/FLINK-8365 Project: Flink Issue Type: Improvement Components: State Backends, Checkpointing Affects Versions: 1.4.0 Reporter: Bowen Li Assignee: Bowen Li Fix For: 1.5.0
{{stateTable}} in HeapListState and {{HeapKeyedStateBackend#createListState()}} are both strongly typed to {{ArrayList}} right now. As discussed with [~StephanEwen] and [~stefanrichte...@gmail.com] in https://github.com/apache/flink/pull/4963, we may want to relax the type to {{List}}. Problems discovered now: 1. That may require changing serializer from {{ArrayListSerializer}} to {{ListSerializer}} in the following code, and we need to discuss the pros and cons {code:java} @Override public <N, T> InternalListState<N, T> createListState( TypeSerializer<N> namespaceSerializer, ListStateDescriptor<T> stateDesc) throws Exception { // the list state does some manual mapping, because the state is typed to the generic // 'List' interface, but we want to use an implementation typed to ArrayList // using a more specialized implementation opens up runtime optimizations StateTable<K, N, ArrayList<T>> stateTable = tryRegisterStateTable( stateDesc.getName(), stateDesc.getType(), namespaceSerializer, new ArrayListSerializer<T>(stateDesc.getElementSerializer())); return new HeapListState<>(stateDesc, stateTable, keySerializer, namespaceSerializer); } {code} 2. for non-RocksDBStateBackend (AsyncFileStateBackendTest, AsyncMemoryStateBackendTest, FileStateBackendTest, and MemoryStateBackendTest), unit tests testListState and testListStateAddUpdateAndGet fail -- This message was sent by Atlassian JIRA (v6.4.14#64029)