[ 
https://issues.apache.org/jira/browse/IMPALA-15057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18116665#comment-18116665
 ] 

ASF subversion and git services commented on IMPALA-15057:
----------------------------------------------------------

Commit 1e3598ce499bb1518896f5911ccd2088990e1598 in impala's branch 
refs/heads/master from Zoltan Borok-Nagy
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=1e3598ce4 ]

IMPALA-15057: Add variant_get() builtin and first-class VARIANT expressions

The patch adds
  variant_get(VARIANT, STRING) -> VARIANT
  variant_get(VARIANT, STRING, STRING) -> <type>
  try_variant_get() (2-args and 3-args as well)
  variant_to_json(VARIANT).

There are two main parts: an infrastructure part that makes VARIANT a
first-class expression type, and a feature part that implements the
functions on top of it.

The infrastructure part makes VARIANT a first-class expression type. It
introduces the VariantVal UDF ABI (two StringVals: metadata + value) and
unblocks the mechanisms that previously restricted VARIANT to a
scan-only pass-through SlotRef: AnyVal sizing/alignment/marshalling,
symbol mangling, the Get*Val eval dispatch and interpreted overrides,
RawValue::WriteVariant materialization, and the FE type-resolution and
guard checks. Result rendering (hs2-util, query-result-set) now consumes
a VariantVal instead of a raw slot. Because VARIANT codegen is
unimplemented, any expression tree that involves a VARIANT type is
forced onto the interpreted path.

The feature part implements the functions in variant-functions-ir.cc:
* the 2-arg form returns a zero-copy slice (shared metadata, value
sub-slice)
* the 3-arg form coerces to primitive type with widening,
  checked narrowing, and string parsing. STRING results are rendered
  through the JSON serializer
* DATE is only produced from a DATE value, not silently reinterpreted
  from an integer

The typed forms are registered under internal names because the catalog
cannot hold overloads that differ only by return type. FunctionCallExpr
maps the type tag to the internal overload.

Testing:
* backend tests added
* e2e tests added

Change-Id: I55bfed394ac2fb57135fadedd489f59e4cc10de4
Assisted-by: Claude Opus 5 (Claude Code)
Reviewed-on: http://gerrit.cloudera.org:8080/24557
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Add variant_get function to extract values from VARIANTs
> --------------------------------------------------------
>
>                 Key: IMPALA-15057
>                 URL: https://issues.apache.org/jira/browse/IMPALA-15057
>             Project: IMPALA
>          Issue Type: Sub-task
>          Components: Backend, Frontend
>            Reporter: Zoltán Borók-Nagy
>            Assignee: Zoltán Borók-Nagy
>            Priority: Major
>              Labels: impala-iceberg, impala-iceberg-active-backlog
>
> We want to support the following function:
> {noformat}
> variant_get(v, '$.path')         -- return VARIANT
> variant_get(v, '$.path', 'type') -- extract typed values from variant
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to