BigQuery named query parameters (@name) are parsed as the @ absolute value operator and emitted as ABS(name).
Version: @polyglot-sql/sdk 0.12.1
Repro
transpile('SELECT * FROM UNNEST(@sites) AS site', Dialect.BigQuery, Dialect.DuckDB).sql[0];
transpile('SELECT x FROM t WHERE id IN UNNEST(@ids)', Dialect.BigQuery, Dialect.DuckDB).sql[0];
Actual
SELECT * FROM UNNEST(ABS(sites)) AS _t0(site)
SELECT x FROM t WHERE CASE WHEN ABS(ids) IS NULL OR ARRAY_LENGTH(ABS(ids)) = 0 THEN FALSE WHEN ARRAY_CONTAINS(ABS(ids), id) THEN TRUE WHEN id IS NULL OR ARRAY_LENGTH(ABS(ids)) <> LIST_COUNT(ABS(ids)) THEN NULL ELSE FALSE END
Expected
@sites / @ids are parsed as parameters (BigQuery has no @ absolute value operator) and emitted as a parameter placeholder in the target dialect. For reference, sqlglot emits UNNEST($sites) for DuckDB.
BigQuery named query parameters (
@name) are parsed as the@absolute value operator and emitted asABS(name).Version:
@polyglot-sql/sdk0.12.1Repro
Actual
Expected
@sites/@idsare parsed as parameters (BigQuery has no@absolute value operator) and emitted as a parameter placeholder in the target dialect. For reference, sqlglot emitsUNNEST($sites)for DuckDB.