From 3cac1256743a65dce9dcc5082b2e0da726ac90cf Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Mon, 17 Jun 2024 11:12:55 -0700 Subject: [PATCH] Add a comment. --- clients/bigquery/dialect/dialect.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clients/bigquery/dialect/dialect.go b/clients/bigquery/dialect/dialect.go index bc4c93d3c..33804b1c3 100644 --- a/clients/bigquery/dialect/dialect.go +++ b/clients/bigquery/dialect/dialect.go @@ -156,6 +156,9 @@ func (bd BigQueryDialect) BuildIsNotToastValueExpression(tableAlias constants.Ta func (bd BigQueryDialect) BuildDedupeTableQuery(tableID sql.TableIdentifier, primaryKeys []string) string { primaryKeysEscaped := sql.QuoteIdentifiers(primaryKeys, bd) + + // BigQuery does not like DISTINCT for JSON columns, so we wrote this instead. + // Error: Column foo of type JSON cannot be used in SELECT DISTINCT return fmt.Sprintf(`(SELECT * FROM %s QUALIFY ROW_NUMBER() OVER (PARTITION BY %s ORDER BY %s) = 1)`, tableID.FullyQualifiedName(), strings.Join(primaryKeysEscaped, ", "),