Skip to content

Commit

Permalink
Merge branch 'master' into refactor-dedupe-signature
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 authored Jun 17, 2024
2 parents 5cc1bd0 + 50ca572 commit d09fbcc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clients/bigquery/dialect/dialect.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,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, ", "),
Expand Down

0 comments on commit d09fbcc

Please sign in to comment.