sepuri sai krishna created FLINK-40726:
------------------------------------------

             Summary: Reading a key from a map returned by MAP_FROM_ARRAYS / 
MAP_FROM_ENTRIES / MAP_UNION fails with ClassCastException
                 Key: FLINK-40726
                 URL: https://issues.apache.org/jira/browse/FLINK-40726
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 2.4.0
            Reporter: sepuri sai krishna


Key access on a map produced by {{MAP_FROM_ARRAYS}}, {{MAP_FROM_ENTRIES}} or
{{MAP_UNION}} fails at runtime:

{code:sql}
SELECT MAP_FROM_ARRAYS(k, v)['a'] FROM src;
{code}

{noformat}
java.lang.ClassCastException: class 
org.apache.flink.table.runtime.util.MapDataContainer
  cannot be cast to class org.apache.flink.table.data.GenericMapData
    at BatchExecCalc$21.processElement(Unknown Source)
{noformat}

The same happens for {{MAP_FROM_ENTRIES}} and {{MAP_UNION}}. It fails in the
generated operator while processing records, so the job fails rather than
returning a wrong result. A map literal is unaffected: {{SELECT 
MAP['a',1]['a']}}
returns 1.

Reproduced on master against a table source, so not constant folding. I have a
fix and tests ready, could someone assign this to me?




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to