`SHOW TABLES ... LIKE 'p' LIMIT n` is displayed with the `LIKE` after `LIMIT`

Abierto
#2,805 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
62/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
clickhouse, mysql, rust, sql
Área
databases

Línea de trabajo

Start with parse_show_stmt_options in the parser, where the suffix LIKE filter is read right after show_in, then compare it with Display for ShowStatementOptions, which writes the fields in a different order. Check the round-trip tests for SHOW TABLES and SHOW DATABASES with a ClickHouseDialect. Done when SHOW TABLES FROM system LIKE '%user%' LIMIT 2 displays in the same order it was parsed and reparses with the filter intact, and the Snowflake infix case still round-trips.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

ClickHouse MySQL Prolific Author

With dialects that take the LIKE filter as a suffix (ClickHouse, MySQL, Generic, ...), Display writes it after LIMIT, and the output reparses as a LIKE inside the limit expression:

SHOW TABLES FROM system LIKE '%user%' LIMIT 2        (ClickHouseDialect)
  -> displays as: SHOW TABLES FROM system LIMIT 2 LIKE '%user%'
  -> reparses with LIMIT (2 LIKE '%user%') and no filter
SHOW DATABASES LIKE '%de%' LIMIT 2
  -> displays as: SHOW DATABASES LIMIT 2 LIKE '%de%'   (same AST change)
SHOW TABLES LIKE 'x%' LIMIT 2                        (SnowflakeDialect, infix filter)
  -> round-trips (fine)

ClickHouse puts the pattern before LIMIT: SHOW [FULL] [TEMPORARY] TABLES [{FROM | IN} <db>] [[NOT] LIKE | ILIKE '<pattern>'] [LIMIT <N>] ... (https://clickhouse.com/docs/sql-reference/statements/show).

parse_show_stmt_options reads the suffix filter right after show_in, before STARTS WITH / LIMIT / FROM, but Display for ShowStatementOptions uses "{like_in_infix}{show_in}{starts_with}{limit}{from}{like_in_suffix}".

Tested on main ce12f1f6 (also 0.63.0 and 0.58.0).

Found with a property-based fuzzer (round trip check); I used AI assistance for triage and verified every case above.

Lenguaje dominante
Rust
Estrellas
3.5k
Forks
805
Merge medio
2 d 3 h
PR fusionados (30 d)
116

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/datafusion-sqlparser-rs

Todos los issues de apache/datafusion-sqlparser-rs

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.