flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-5790) Use list types when ListStateDescriptor extends StateDescriptor
Date Tue, 14 Feb 2017 16:09:42 GMT

    [ https://issues.apache.org/jira/browse/FLINK-5790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15866026#comment-15866026

ASF GitHub Bot commented on FLINK-5790:

Github user tillrohrmann commented on a diff in the pull request:

    --- Diff: flink-core/src/main/java/org/apache/flink/api/common/state/ListStateDescriptor.java
    @@ -62,10 +68,19 @@ public ListStateDescriptor(String name, TypeInformation<T> typeInfo)
     	 * @param name The (unique) name for the state.
     	 * @param typeSerializer The type serializer for the list values.
    +	@SuppressWarnings("unchecked")
     	public ListStateDescriptor(String name, TypeSerializer<T> typeSerializer) {
    -		super(name, typeSerializer, null);
    +		super(name, new ListSerializer<>(typeSerializer), null);
    +	}
    +	public TypeSerializer<T> getElementSerializer() {
    +		if (!(serializer instanceof ListSerializer)) {
    +			throw new IllegalStateException();
    --- End diff --
    We should add a meaningful error message.

> Use list types when ListStateDescriptor extends StateDescriptor
> ---------------------------------------------------------------
>                 Key: FLINK-5790
>                 URL: https://issues.apache.org/jira/browse/FLINK-5790
>             Project: Flink
>          Issue Type: Improvement
>            Reporter: Xiaogang Shi
>            Assignee: Xiaogang Shi
> Flink keeps the state serializer in {{StateDescriptor}}, but it's the serializer of list
elements  that is put in {{ListStateDescriptor}}. The implementation is a little confusing.
Some backends need to construct the state serializer with the element serializer by themselves.
> We should use an {{ArrayListSerializer}}, which is composed of the serializer of the
element, in the {{ListStateDescriptor}}. It helps the backend to avoid constructing the state
> If a backend needs customized serialization of the state (e.g. {{RocksDBStateBackend}}),
it still can obtain the element serializer from the {{ArrayListSerializer}}.

This message was sent by Atlassian JIRA

View raw message