Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5778

Add ARRAY_JOIN, ARRAYS_OVERLAP, ARRAYS_ZIP for Spark dialect

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.35.0
    • 1.35.0
    • core

    Description

      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:

       > 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

      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:

      > SELECT arrays_overlap(array(1, 2, 3), array(3, 4, 5));
       true 

      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:

      > 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}] 

      Attachments

        Issue Links

          Activity

            People

              jackylau Jacky Lau
              jackylau Jacky Lau
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: