You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Stefan Richter (JIRA)" <ji...@apache.org> on 2018/01/23 13:30:00 UTC

[jira] [Closed] (FLINK-8365) Relax List type in HeapListState and HeapKeyedStateBackend

     [ https://issues.apache.org/jira/browse/FLINK-8365?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Richter closed FLINK-8365.
---------------------------------
    Resolution: Fixed

Merged in e075da5d5eb0f5ae8c394ea0c549f9dbce28fcf3 .

> 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.5.0
>            Reporter: Bowen Li
>            Assignee: Bowen Li
>            Priority: Major
>             Fix For: 1.5.0
>
>
> {{stateTable}} in HeapListState and {{HeapKeyedStateBackend#createListState()}} are both strongly typed to {{ArrayList}} right now.
> As discussed with [~StephanEwen] and [~stefanrichter83@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
(v7.6.3#76005)