Ramin Gharib created FLINK-41348:
------------------------------------

             Summary: Merge nested VARIANT modification calls into one pass
                 Key: FLINK-41348
                 URL: https://issues.apache.org/jira/browse/FLINK-41348
             Project: Flink
          Issue Type: Sub-task
          Components: Table SQL / Planner
            Reporter: Ramin Gharib


Each modification function reads a whole VARIANT and writes a new one. In a 
nested chain, each inner result is written only for the next call to read. A 
planner rule replaces the chain with one internal call that does all the edits 
in one pass.

{code:sql}
VARIANT_DELETE(VARIANT_SET(v, '$.processed_at', ts), '$.user.email')
-- Without the rule: VARIANT_SET writes v1, VARIANT_DELETE reads v1 and writes 
v2
-- With the rule:    one call reads v, applies both edits and writes v2
{code}

Scope:
* The result is the same, and the edits still run from the inner call to the 
outer call.
* Skip a chain when the query also uses an inner result on its own, such as in 
another column.
* Skip a chain that contains a TRY_ call.
* VARIANT_MERGE joins the rule once FLINK-41347 lands.
* Plan tests for merged and skipped chains, and restore tests from compiled 
plans.

Depends on FLINK-41339, FLINK-41340, FLINK-41341 and FLINK-41342



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

Reply via email to