Ramin Gharib created FLINK-41343:
------------------------------------
Summary: Add Variant#normalize() and VARIANT_NORMALIZE
Key: FLINK-41343
URL: https://issues.apache.org/jira/browse/FLINK-41343
Project: Flink
Issue Type: Sub-task
Components: Table SQL / API, API / Core
Reporter: Ramin Gharib
{code:sql}
VARIANT_NORMALIZE(variant) -- VARIANT
VARIANT_NORMALIZE(VARIANT_DELETE(v, '$.user.email'))
--
{"coupon":null,"items":[{"qty":2,"sku":"A1"}],"order_id":17,"user":{"name":"ada"}},
with email gone from the metadata too
{code}
Scope:
* Rewrites the value in one standard layout: the keys of each object in order,
and only the field names in use, in a sorted list.
* Values and their stored types stay the same, so VARIANT_TYPE gives the same
answer.
* If an object has a key twice, the first one is kept.
* A value already in that layout comes back unchanged. The check reads only the
object headers.
* SQL NULL gives NULL.
* The Java method Variant#normalize() and unit tests for it. VARIANT_NORMALIZE
calls it.
* 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)