Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-9879

Support STRING_AGG in BeamSQL

Details

    • Task
    • Status: Resolved
    • P3
    • Resolution: Fixed
    • None
    • 2.37.0
    • dsl-sql, dsl-sql-zetasql
    • None

    Description

      Support STRING_AGG function in ZetaSQL dialect. (Also if Calcite has this function built-in, support it in Calcite dialect too)

      See the reference: https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#string_agg

      SELECT
             STRING_AGG(c) str_agg_unary,
             STRING_AGG(c, ", ") str_agg_binary,
             STRING_AGG(d) bytes_agg_unary,
             STRING_AGG(d, b", ") bytes_agg_binary
      

      More test cases here: https://github.com/google/zetasql/blob/c55f967a5ae35b476437210c529691d8a73f5507/zetasql/compliance/testdata/aggregation_queries.test

      Examples:

      SELECT STRING_AGG(fruit) AS string_agg
      FROM UNNEST(["apple", NULL, "pear", "banana", "pear"]) AS fruit;
      
      +------------------------+
      | string_agg             |
      +------------------------+
      | apple,pear,banana,pear |
      +------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              benglez Benjamin Gonzalez
              amaliujia Rui Wang
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: