[
https://issues.apache.org/jira/browse/FLINK-41339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ramin Gharib reassigned FLINK-41339:
------------------------------------
Assignee: Ramin Gharib
> Add VARIANT_SET, VARIANT_INSERT and their TRY_ forms
> ----------------------------------------------------
>
> Key: FLINK-41339
> URL: https://issues.apache.org/jira/browse/FLINK-41339
> Project: Flink
> Issue Type: Sub-task
> Components: Table SQL / API, Table SQL / Runtime
> Reporter: Ramin Gharib
> Assignee: Ramin Gharib
> Priority: Major
>
> {code:sql}
> VARIANT_SET(variant, path, value [, create_if_missing]) -- VARIANT
> VARIANT_INSERT(variant, path, value) -- VARIANT
> VARIANT_SET(v, '$.user.name', 'Ada L.')
> --
> {"coupon":null,"items":[{"qty":2,"sku":"A1"}],"order_id":17,"user":{"email":"[email protected]","name":"Ada
> L."}}
> VARIANT_INSERT(v, '$.gift', TRUE)
> --
> {"coupon":null,"gift":true,"items":[{"qty":2,"sku":"A1"}],"order_id":17,"user":{"email":"[email protected]","name":"ada"}}
> {code}
> Scope:
> * VARIANT_SET replaces the target or creates it with any missing parents.
> With create_if_missing = FALSE, it only replaces.
> * VARIANT_INSERT never replaces. In an array, later elements shift right. An
> existing object field fails.
> * Both pad an index past the end with variant nulls and reject the root path
> $.
> * A path through a scalar, such as $.order_id.x, fails. TRY_VARIANT_SET and
> TRY_VARIANT_INSERT return NULL instead.
> * A value can be any type that CAST(x AS VARIANT) accepts. 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)