* fix(bigquery): give a FROM-less SELECT a single-row source [CLAUDE]
BigQuery rejects a query without a FROM clause when it has a WHERE,
GROUP BY, HAVING, QUALIFY or ORDER BY clause, SELECT DISTINCT, or an
aggregate or analytic function, while other dialects accept it. The
BigQuery generator now adds FROM (SELECT 1) to such a select, which keeps
its rows.
The source stays unaliased, because an alias can capture a correlated
reference meant for the outer query. A select whose unqualified star would
expand over the source is left as written, and so is a select with no
enclosing query whose projections or WHERE reference a column, since that
column has nothing to bind to either way. Projection aliases named in its
GROUP BY, ORDER BY, HAVING or QUALIFY still get the source.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(bigquery): drop the guards from the FROM-less source transform [CLAUDE]
The unqualified star and column-binding guards only protected queries that
BigQuery rejects with or without the source, so a FROM-less select now gets
FROM (SELECT 1) whenever it has a clause, DISTINCT, or an aggregate or
analytic function that BigQuery refuses without a FROM. A named WINDOW
definition on its own doesn't count as an analytic function.
Shorthand tests such as SELECT ARRAY_AGG(x ORDER BY x) now expect the source
in their BigQuery output.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(bigquery): add the FROM-less source for a WINDOW clause too [CLAUDE]
BigQuery rejects a WINDOW clause without a FROM as well, so it joins the
clauses that trigger the single-row source. Aggregate and analytic
functions are looked up in the projections' own scope with find_in_scope,
after the clause checks.
The FROM-less test inputs now read from the default dialect, since they're
invalid BigQuery, and the bare HAVING case becomes one with an aggregate,
which BigQuery accepts once the source is added.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>