Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-23899 Built-in SQL Function Improvement
  3. SPARK-23908

High-order function: transform(array<T>, function<T, U>) → array<U>

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.4.0
    • Component/s: SQL
    • Labels:
      None

      Description

      Ref: https://prestodb.io/docs/current/functions/array.html

      Returns an array that is the result of applying function to each element of array:

      SELECT transform(ARRAY [], x -> x + 1); -- []
      SELECT transform(ARRAY [5, 6], x -> x + 1); -- [6, 7]
      SELECT transform(ARRAY [5, NULL, 6], x -> COALESCE(x, 0) + 1); -- [6, 1, 7]
      SELECT transform(ARRAY ['x', 'abc', 'z'], x -> x || '0'); -- ['x0', 'abc0', 'z0']
      SELECT transform(ARRAY [ARRAY [1, NULL, 2], ARRAY[3, NULL]], a -> filter(a, x -> x IS NOT NULL)); -- [[1, 2], [3]]
      

        Attachments

          Activity

            People

            • Assignee:
              ueshin Takuya Ueshin
              Reporter:
              smilegator Xiao Li
            • Votes:
              4 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: