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

未关闭
#2,805 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
clickhouse, mysql, rust, sql
领域
databases

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Rust
星标
3.5k
派生
805
平均合并
2 天 3 小时
30 天内合并 PR
116

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/datafusion-sqlparser-rs 的其他 Issue

查看 apache/datafusion-sqlparser-rs 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。