BigQuery: region-qualified INFORMATION_SCHEMA reference is rewritten across transpile passes, gaining an invented alias
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 28/100
Línea de trabajo
Run the two-pass snippet from the issue to confirm the drift, then read the BigQuery dialect in sqlglot/dialects/bigquery.py, where INFORMATION_SCHEMA table parts are parsed and the alias/quoting is generated; the related history in #4336 explains the single-identifier preference. The example comes from tests/dialects/test_bigquery.py, so add a fixed-point assertion there. Done means applying transpile twice leaves region_or_dataset.INFORMATION_SCHEMA.TABLES unchanged, with no invented AS TABLES alias and no whole-path quoting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Fully reproducible code snippet
import sqlglot
s = "SELECT * FROM region_or_dataset.INFORMATION_SCHEMA.TABLES"
g1 = sqlglot.transpile(s, read="bigquery", write="bigquery")[0]
# 'SELECT * FROM region_or_dataset.`INFORMATION_SCHEMA.TABLES` AS TABLES'
g2 = sqlglot.transpile(g1, read="bigquery", write="bigquery")[0]
# 'SELECT * FROM `region_or_dataset.INFORMATION_SCHEMA.TABLES` AS TABLES'
The input is taken from sqlglot's own BigQuery tests.
Expected
A multi-part table path round-trips as the same table path, with no alias added.
Actual
The first generation quotes INFORMATION_SCHEMA.TABLES as a single identifier and invents an AS TABLES alias that is not in the source. The second generation quotes the entire dotted path as one identifier, changing the reference's meaning (one name containing dots instead of separate parts). It converges at g2, but at the wrong value. Related history: #4336 made the parser favour a single identifier for INFORMATION_SCHEMA.X, which makes the hybrid first-pass form, and the drift between passes, the inconsistency.
Checked against main at commit b294f7f.
Official Documentation
BigQuery INFORMATION_SCHEMA (including region qualifiers): https://cloud.google.com/bigquery/docs/information-schema-intro
Found by property-based testing (a round-trip fixed-point property over sqlglot's own test corpus).
- Lenguaje dominante
- Python
- Estrellas
- 9.8k
- Forks
- 1.4k
- Merge medio
- 13 h 19 min
- PR fusionados (30 d)
- 243
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tobymao/sqlglot
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
SQLite: CAST(x AS JSON) is generated verbatim, which SQLite evaluates as a numeric castPosiblemente ocupada @Gowthamsuryagolla la tomó hoy. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 32/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
-
Optimizer drops parentheses for `NOT (<date> = DATE_TRUNC(...))`, changing query resultsPosiblemente ocupada @parthdembla007 la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
Los mantenedores suelen responder en 1 día
-
DATE_ADD/DATE_SUB with a single argument raises AttributeError (BigQuery, MySQL, Doris, StarRocks)Posiblemente ocupada @akchhayasharma la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
Todos los issues de tobymao/sqlglot
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
alltheplaces/alltheplaces#20570 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
area:ci bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
catincloud-labs/dagster-dex#206 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
number_to_words raises ValueError with threshold= for ordinals ("12th") and comma-grouped strings ("1,000")Posiblemente ocupada @hemtilva la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
providers security
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
agentbreeder/agentbreeder#1031 ·
Los mantenedores suelen responder en 1 día