You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "xiong duan (Jira)" <ji...@apache.org> on 2023/06/26 06:07:00 UTC
[jira] [Resolved] (CALCITE-5778) Add ARRAY_JOIN, ARRAYS_OVERLAP, ARRAYS_ZIP for Spark dialect
[ https://issues.apache.org/jira/browse/CALCITE-5778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
xiong duan resolved CALCITE-5778.
---------------------------------
Resolution: Fixed
> Add ARRAY_JOIN, ARRAYS_OVERLAP, ARRAYS_ZIP for Spark dialect
> ------------------------------------------------------------
>
> Key: CALCITE-5778
> URL: https://issues.apache.org/jira/browse/CALCITE-5778
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.35.0
> Reporter: jackylau
> Assignee: jackylau
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.35.0
>
>
> h3. [array_join|https://spark.apache.org/docs/latest/api/sql/index.html#array_join]
> array_join(array, delimiter[, nullReplacement]) - Concatenates the elements of the given array using the delimiter and an optional string to replace nulls. If no value is set for nullReplacement, any null value is filtered.
> *Examples:*
> {code:java}
> > SELECT array_join(array('hello', 'world'), ' ');
> hello world
> > SELECT array_join(array('hello', null ,'world'), ' ');
> hello world
> > SELECT array_join(array('hello', null ,'world'), ' ', ',');
> hello , world{code}
> h3. [arrays_overlap|https://spark.apache.org/docs/latest/api/sql/index.html#arrays_overlap]
> arrays_overlap(a1, a2) - Returns true if a1 contains at least a non-null element present also in a2. If the arrays have no common element and they are both non-empty and either of them contains a null element null is returned, false otherwise.
> *Examples:*
> {code:java}
> > SELECT arrays_overlap(array(1, 2, 3), array(3, 4, 5));
> true {code}
> h3. [arrays_zip|https://spark.apache.org/docs/latest/api/sql/index.html#arrays_zip]
> arrays_zip(a1, a2, ...) - Returns a merged array of structs in which the N-th struct contains all N-th values of input arrays.
> *Examples:*
> {code:java}
> > SELECT arrays_zip(array(1, 2, 3), array(2, 3, 4));
> [{"0":1,"1":2},{"0":2,"1":3},{"0":3,"1":4}]
> > SELECT arrays_zip(array(1, 2), array(2, 3), array(3, 4));
> [{"0":1,"1":2,"2":3},{"0":2,"1":3,"2":4}] {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)