flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "buptljy (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-9834) Unable to support scala BasicArrayTypeInfo
Date Wed, 25 Jul 2018 05:34:00 GMT

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

buptljy commented on FLINK-9834:
--------------------------------

It seems that we can use _*implicitly[TypeInformation[Array[Byte]]]*_ to do that, although
I don't think it's an appropriate way....

> 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)

Mime
View raw message