Ramin Gharib created FLINK-41340:
------------------------------------

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


{code:sql}
VARIANT_DELETE(variant, path [, path ...])   -- VARIANT
VARIANT_PICK(variant, path [, path ...])     -- VARIANT

VARIANT_DELETE(v, '$.user.email')
-- 
{"coupon":null,"items":[{"qty":2,"sku":"A1"}],"order_id":17,"user":{"name":"ada"}}
VARIANT_PICK(v, '$.order_id', '$.user.name')
-- {"order_id":17,"user":{"name":"ada"}}
{code}

Scope:
* VARIANT_DELETE removes the targets, left to right. A missing path is ignored, 
even one that crosses a scalar. It rejects the root path $.
* VARIANT_PICK keeps only the given paths and the objects and arrays that lead 
to them. Missing paths are ignored. If none match, an object gives an empty 
object.
* In both, a SQL NULL variant gives NULL and a NULL path is skipped. Neither 
fails on a valid path, so neither has a TRY_ form.
* 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