villebro opened a new pull request #9854: URL: https://github.com/apache/incubator-superset/pull/9854
### SUMMARY On BigQuery, some WHERE clauses on nested fields of RECORD type columns were failing due to aliases being added to all columns in the WHERE clause. This is in violation of the BigQuery spec, but also more generally inconsistent with the ANSI SQL spec: > You cannot reference column aliases from the SELECT list in the WHERE clause. Source: https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#where_clause > Standard SQL disallows references to column aliases in a WHERE clause. This restriction is imposed because when the WHERE clause is evaluated, the column value may not yet have been determined. Source: https://dev.mysql.com/doc/refman/8.0/en/problems-with-alias.html This PR disables aliasing for WHERE clauses **for all engines**, and fixes the immediate problem for BigQuery. I propose getting this merged ASAP to fix the observed BigQuery bug, but propose adding unit tests later for this as we add proper tests for officially supported database engines. ### BEFORE  Note the alias being referenced in the WHERE clause ### AFTER  Note the original field name being referenced in the WHERE clause, with the alias being referenced by the GROUPBY clause. ### TEST PLAN CI ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: closes #9836 - [ ] Changes UI - [ ] Requires DB Migration. - [ ] Confirm DB Migration upgrade and downgrade tested. - [ ] Introduces new feature or API - [ ] Removes existing feature or API FYI: @esilver ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
