Gustavo de Morais created FLINK-39515:
-----------------------------------------

             Summary: Add Restore Tests and fix compiled plan restoration for 
TO and FROM Changelog
                 Key: FLINK-39515
                 URL: https://issues.apache.org/jira/browse/FLINK-39515
             Project: Flink
          Issue Type: Sub-task
          Components: Table SQL / API
    Affects Versions: 2.3.0, 2.4.0
            Reporter: Gustavo de Morais
            Assignee: Gustavo de Morais


When restoring a compiled plan whose query calls a built-in PTF with unprovided 
optional args (e.g., {{TO_CHANGELOG(input => TABLE t)}} without {{op}} / 
{{{}op_mapping{}}}), code generation fails:

 
{code:java}
Unsupported call: DEFAULT() {code}
 
h3. Cause

Unprovided slots are filled by {{{}SqlDefaultArgOperator{}}}, a per-call-site 
instance that carries the expected return type. It's not registered in any 
operator table, so on restore, {{RexNodeJsonDeserializer}} falls through to 
Calcite's stock {{{}SqlStdOperatorTable.DEFAULT_OPERATOR{}}}.

The codegen check {{op instanceof SqlDefaultArgOperator}} 
(StringCallGen.scala:242) misses, and the call hits the generic unsupported 
branch.

The same bug affects any built-in PTF that exposes optional user-level args 
(those survive {{toUdfCall}} and reach codegen). Existing user-defined PTF 
restore tests don't catch it because their {{DEFAULT()}} operands are system 
args ({{{}uid{}}}, {{{}on_time{}}}) that {{toUdfCall}} strips.



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

Reply via email to