ClickHouse: tuple element access followed by a field changes meaning after round-trip
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
调研方向
从 ClickHouse 方言的 Display 实现和 fuzz_parse_roundtrip 目标开始,以复现用例 SELECT t.1.name 作为起始案例。将打印出的 SQL 与预期的带空格访问链进行比较,并验证重新解析后产生相同的 AST;src/Parsers/Lexer.cpp 提供了 lexer 消歧所需的上下文。
由索引模型根据 Issue 内容生成。
描述
Description
With ClickHouseDialect, a tuple element access followed by a named field prints without spaces around the second dot. The printed SQL parses back as a different query, with no error.
Reproduction
use sqlparser::dialect::ClickHouseDialect;
use sqlparser::parser::Parser;
let sql = "SELECT t.1.name";
let ast = Parser::parse_sql(&ClickHouseDialect {}, sql).unwrap();
let printed = ast[0].to_string();
println!("{printed}"); // SELECT t . 1.name
let reparsed = Parser::parse_sql(&ClickHouseDialect {}, &printed).unwrap();
println!("{}", reparsed[0]); // SELECT t . 1. AS name
| Step | Result |
|---|---|
| Input | SELECT t.1.name |
| Parsed | CompoundFieldAccess { root: t, access_chain: [Dot(1), Dot(name)] } (correct) |
| Printed | SELECT t . 1.name |
| Re-parsed | SELECT t . 1. AS name: the number 1. with alias name |
Expected
The printed output keeps the access chain, e.g. SELECT t . 1 . name, and parses back to the same AST.
Context
ClickHouse's lexer tokenizes t.1.name as t . 1 . name (see the "chained tuple access" disambiguation in src/Parsers/Lexer.cpp), so the initial parse is correct and only Display is wrong.
Follow-up to #2574 (tuple element access). Found with the fuzz_parse_roundtrip fuzz target.
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 780
- 平均合并
- 4 天 10 小时
- 30 天内合并 PR
- 60
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion-sqlparser-rs 的其他 Issue
-
ClickHouse
难度 2/5 1-3 小时 新手友好度 76/100
apache/datafusion-sqlparser-rs#2597 ·
维护者通常 2 天内回复
-
Hive
难度 2/5 1-3 小时 新手友好度 70/100
apache/datafusion-sqlparser-rs#2589 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
apache/datafusion-sqlparser-rs#2461 · 2 条评论 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
apache/datafusion-sqlparser-rs#2407 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
apache/datafusion-sqlparser-rs#2393 ·
维护者通常 2 天内回复
查看 apache/datafusion-sqlparser-rs 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 82/100
canonical/opentelemetry-collector-operator#409 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug CLI exec tool-calls
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复