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

ASF GitHub Bot updated FLINK-41780:
-----------------------------------
    Labels: pull-request-available  (was: )

> Map element access fails with ClassCastException for a MapData that is 
> neither BinaryMapData nor GenericMapData
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-41780
>                 URL: https://issues.apache.org/jira/browse/FLINK-41780
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Runtime
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>              Labels: pull-request-available
>
> {{map['key']}} fails at runtime when the map is a {{MapData}} other than 
> {{BinaryMapData}} or {{GenericMapData}}.
> Example: a UDF that returns a {{MapDataContainer}}:
> {code:java}
> public static class WrapMapFunction extends ScalarFunction {
>     public @DataTypeHint(value = "MAP<STRING, STRING>", bridgedTo = 
> MapData.class) MapData eval() {
>         return new MapDataContainer(
>                 new GenericArrayData(new Object[] 
> {StringData.fromString("a")}),
>                 new GenericArrayData(new Object[] 
> {StringData.fromString("x")}));
>     }
> }
> {code}
> {code:sql}
> SELECT wrap_map()['a'] FROM t
> {code}
> fails with:
> {noformat}
> java.lang.ClassCastException: class 
> org.apache.flink.table.runtime.util.MapDataContainer cannot be cast to class 
> org.apache.flink.table.data.GenericMapData
>     at StreamExecCalc$15.processElement(Unknown Source)
> {noformat}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to