Ramin Gharib created FLINK-41336:
------------------------------------
Summary: FLIP-618: Edit, Inspect and Build VARIANT Values
Key: FLINK-41336
URL: https://issues.apache.org/jira/browse/FLINK-41336
Project: Flink
Issue Type: New Feature
Components: Table SQL / API, Table SQL / Planner, API / Core, Table
SQL / Runtime
Reporter: Ramin Gharib
Assignee: Ramin Gharib
Implements FLIP-618:
https://cwiki.apache.org/confluence/spaces/FLINK/pages/461570450/FLIP-618+Edit+Inspect+and+Build+VARIANT+Values
Vote: https://lists.apache.org/thread/hjyffsrx05vzlxto8wtttks25xfwzjg4
VARIANT has existed since 2.1 (FLIP-521), and 2.4 can CAST in both directions.
Users still cannot edit a VARIANT, ask what is inside one, or build one from
columns without a CAST per value. Today, removing one nested field takes a UDF
that rebuilds every level. With this FLIP:
{code:sql}
SELECT VARIANT_DELETE(v, '$.user.email') FROM orders;
--
{"coupon":null,"items":[{"qty":2,"sku":"A1"}],"order_id":17,"user":{"name":"ada"}}
{code}
||Area||Adds||
|Modification|VARIANT_SET, VARIANT_INSERT, VARIANT_DELETE,
VARIANT_ARRAY_APPEND, VARIANT_STRIP_NULLS, VARIANT_PICK, VARIANT_MERGE,
VARIANT_NORMALIZE, plus TRY_ forms|
|Inspection|IS_VARIANT_NULL, VARIANT_EXISTS, VARIANT_CONTAINS, VARIANT_KEYS,
IS_VALID_VARIANT, VARIANT_TYPE, SCHEMA_OF_VARIANT, SCHEMA_OF_VARIANT_AGG|
|Construction|VARIANT_OBJECT, VARIANT_ARRAY, VARIANT_NULL, TO_VARIANT,
VARIANT_OBJECT_AGG|
|Java API|Variant.of, Variant.newBuilder, Variant#toBuilder, VariantBuilder
edit methods, Variant#normalize|
|Planner|One-pass rule for nested modification calls|
Each function subtask ships the SQL function, its Table API and PyFlink
expressions, tests and docs. Paths reuse SimplePath from FLINK-39049. The
modification functions build on the VariantBuilder subtask. FLINK-40582
(SCHEMA_OF_VARIANT) and FLINK-40318 (the check behind IS_VALID_VARIANT) predate
the FLIP and are subtasks here.
Relates to FLINK-37922 (FLIP-521).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)