mozilla / bigquery-etl

Bigquery ETL
https://mozilla.github.io/bigquery-etl
Mozilla Public License 2.0
253 stars 100 forks source link

Fix histogram_cast_json udf #5844

Closed edugfilho closed 3 months ago

edugfilho commented 3 months ago

Cover cases in which the input is an empty array.

Checklist for reviewer:

For modifications to schemas in restricted namespaces (see CODEOWNERS):

┆Issue is synchronized with this Jira Task

dataops-ci-bot commented 3 months ago

Integration report for "Fix histogram_cast_json udf"

sql.diff

Click to expand! ```diff diff -bur --no-dereference --new-file /tmp/workspace/main-generated-sql/sql/mozfun/glam/histogram_cast_json/udf.sql /tmp/workspace/generated-sql/sql/mozfun/glam/histogram_cast_json/udf.sql --- /tmp/workspace/main-generated-sql/sql/mozfun/glam/histogram_cast_json/udf.sql 2024-06-26 00:19:18.000000000 +0000 +++ /tmp/workspace/generated-sql/sql/mozfun/glam/histogram_cast_json/udf.sql 2024-06-26 00:19:05.000000000 +0000 @@ -13,10 +13,13 @@ RETURNS STRING AS ( ( SELECT + COALESCE( CONCAT( '{', STRING_AGG(CONCAT('"', key, '":', ROUND(value, 4)) ORDER BY CAST(key AS FLOAT64)), '}' + ), + "{}" ) FROM UNNEST(histogram) ```

Link to full diff