Fred Teunissen created FLINK-39246:
--------------------------------------

             Summary: ArrayIndexOutOfBoundsException when creating VIEW with 
inline ARRAY of ROW values in Flink 2.2.0
                 Key: FLINK-39246
                 URL: https://issues.apache.org/jira/browse/FLINK-39246
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner, Table SQL / Runtime
    Affects Versions: 2.2.0
            Reporter: Fred Teunissen


h3. Overview

Processing SQL statements with inline ARRAY of ROW values causes an 
ArrayIndexOutOfBoundsException in Flink 2.2.0, while the same statements 
execute successfully in Flink 1.20.3 and 2.1.1. This is a breaking change in 
SQL statement processing.
h3. Affected Functionality

Creating views with inline ARRAY of ROW values where the ROW elements contain 
type casts versus without type casts produces different behavior:

{*}Succeeds in Flink 1.20.3, 2.1.1, and 2.2.0{*}:
{code:sql}
CREATE VIEW vw_succeeded AS
SELECT *
FROM (VALUES (
                ARRAY[
                  ROW(CAST('v21a' AS STRING), CAST('v22aa' AS STRING)),
                  ROW(CAST('v21b' AS STRING), CAST('v22b' AS STRING))
                ]
              )
      ) AS n(labels);
{code}
*Fails in Flink 2.2.0 (but succeeds in 1.20.3 and 2.1.1):*
{code:sql}
CREATE VIEW vw_failed AS
SELECT *
FROM (VALUES (
                 ARRAY[
                   ROW('v21a', 'v22aa'),
                   ROW('v21b', 'v22b')
               ]
             )
     ) AS n(labels);
{code}

*Error Message*

{code:none}
[ERROR] Could not execute SQL statement. Reason:
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
{code}

*Expected Behavior*

The vw_failed view should be created successfully, just as it is with Flink 
1.20.3 and 2.1.1. SQL statements that work in prior versions should continue to 
work in newer versions.



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

Reply via email to