You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "buptljy (JIRA)" <ji...@apache.org> on 2018/07/22 17:06:00 UTC

[jira] [Assigned] (FLINK-9834) Unable to support scala BasicArrayTypeInfo

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

buptljy reassigned FLINK-9834:
------------------------------

    Assignee: buptljy

> Unable to support scala BasicArrayTypeInfo
> ------------------------------------------
>
>                 Key: FLINK-9834
>                 URL: https://issues.apache.org/jira/browse/FLINK-9834
>             Project: Flink
>          Issue Type: Bug
>          Components: Type Serialization System
>            Reporter: buptljy
>            Assignee: buptljy
>            Priority: Major
>
> BasicArrayTypeInfo does not supported scala type in some circumstances. For example,
> {code:scala}
> // we set a descriptor here and get value from it.
> val datas: mutable.Map[String, Array[Byte]] = mutable.Map()
> val descriptor = new MapStateDescriptor("realtime-state",
>     BasicTypeInfo.STRING_TYPE_INFO, BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO)
> val state = context.getKeyedStateStore.getMapState(descriptor)
> val iter = state.entries().iterator()
> while (iter.hasNext) {
>    val entry = iter.next()
>    datas.put(entry.getKey, entry.getValue)
> }
> {code}
> The codes above cannot be compiled successfully because the "state" is using java.lang.Byte but the "datas" is using scala.Byte, and we have to iterate all values of the Array like "datas.put(entry.getKey, entry.getValue.map(byte => byte.asInstanceOf[Byte]))", which is definitely not what we want.
> I suggest that we create a ScalaBasicArrayTypeInfo like the "BasicArrayTypeInfo" for scala.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)