Gustavo de Morais created FLINK-40366:
-----------------------------------------

             Summary: INSERT INTO with a column list or static partition fails 
for set-semantic PTFs
                 Key: FLINK-40366
                 URL: https://issues.apache.org/jira/browse/FLINK-40366
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / API
    Affects Versions: 2.3.0, 2.2.0, 2.1.0
            Reporter: Gustavo de Morais


INSERT INTO t (col) SELECT … FROM ptf(input => TABLE s PARTITION BY k, …) 
throws NullPointerException during planning (IllegalStateException: must call 
validate first with assertions on). The same statement without the column list 
plans fine. A static PARTITION (p = 'x') spec fails the same way, and EXPLAIN 
of the statement fails too, so the failure is not diagnosable by the user.

Affects any set-semantics PTF (PARTITION BY table argument) on 2.1, 2.2, 2.3 
and master. Row-semantics PTFs and column lists without a PTF are unaffected.

Root cause: this is the same defect class as FLINK-40039 at a third, 
independent site. PreValidateReWriter.rewriteInsert runs before validation and 
replaces the insert's source with a newly built SqlSelect whenever a column 
list or static partition is present. Calcite skips validation of set-semantics 
table arguments (validateTableFunction short-circuits on Semantics.SET), so the 
inner table's namespace is never populated for the rewritten tree, and 
SqlToRelConverter.convertIdentifier then calls resolve() on an unvalidated 
namespace.

 



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

Reply via email to