Ramin Gharib created FLINK-41347:
------------------------------------

             Summary: Add VARIANT_MERGE
                 Key: FLINK-41347
                 URL: https://issues.apache.org/jira/browse/FLINK-41347
             Project: Flink
          Issue Type: Sub-task
          Components: Table SQL / API, Table SQL / Runtime
            Reporter: Ramin Gharib


{code:sql}
VARIANT_MERGE(variant, variant [, variant ...])   -- VARIANT

VARIANT_MERGE(v, PARSE_JSON('{"user":{"tier":"gold"},"coupon":"X1"}'))
-- 
{"coupon":"X1","items":[{"qty":2,"sku":"A1"}],"order_id":17,"user":{"email":"[email protected]","name":"ada","tier":"gold"}}
{code}

Scope:
* Merges from left to right. On the same key, the later value wins.
* Two objects under the same key merge the same way. Any other later value 
replaces the earlier one, including an array and a variant null. So a value 
that is not an object replaces everything before it.
* Unlike JSON_MERGE_PATCH, a variant null is stored, not used to delete a key.
* A SQL NULL argument gives NULL.
* Table API and PyFlink expressions, SQL and Table API tests, docs.

Depends on FLINK-41338



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

Reply via email to