GoogleCloudPlatform / bigquery-utils

Useful scripts, udfs, views, and other utilities for migration and data warehouse operations in BigQuery.
https://cloud.google.com/bigquery/
Apache License 2.0
1.13k stars 283 forks source link

Add functions for emulating Snowflake/Postgresql's mode() #464

Closed Hackerpilot closed 1 month ago

Hackerpilot commented 1 month ago

For b/357127978

Unfortunately I can't declare these as

CREATE OR REPLACE AGGREGATE FUNCTION ${self()}(b ANY TYPE)
RETURNS ANY TYPE
....

I've also noticed that it is possible to overload on types for CREATE TEMPORARY FUNCTION but not CREATE FUNCTION, thus these all have their argument types in the name.

If I've missed a way to avoid duplicating the code, please let me know.

danieldeleo commented 1 month ago

/gcbrun