buptljy created FLINK-9834:
------------------------------
Summary: 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
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)
|