Skip to content

完成了 别名逻辑 & FROM多表 & JOIN逻辑#15

Merged
ChesterNotChest merged 12 commits into
masterfrom
chester
May 17, 2026
Merged

完成了 别名逻辑 & FROM多表 & JOIN逻辑#15
ChesterNotChest merged 12 commits into
masterfrom
chester

Conversation

@ChesterNotChest
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 扩展了 SQL 解析与执行链路,补齐了 SELECT 的表别名/限定列/投影别名/ORDER BY 别名,并新增 FROM 多表(逗号)与 JOIN ... ON 的解析与执行,同时补充了 ALTER TABLE 的局部 ALTER COLUMN / RENAME COLUMN 语法与 dispatcher 侧补全执行逻辑。

Changes:

  • 扩展 SELECT parser:支持投影别名、FROM 多表与 JOIN payload(fromSources/joins/isMultiTable),并增强 ORDER BY 支持限定列。
  • 扩展执行侧:dispatcher 增加单表名字解析;QueryExecutor 增加多表执行(笛卡尔积/INNER/LEFT/RIGHT/FULL JOIN、ORDER BY、LIMIT、投影别名)。
  • 扩展 ALTER TABLE parser + dispatcher:支持 ALTER COLUMN SET/DROP DEFAULTSET/DROP NOT NULLTYPE ...RENAME COLUMN,并新增回归测试与测试计划文档。

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
utils/sql_parser/tuple_parser.cpp SELECT 投影/别名解析、FROM 多表与 JOIN 解析,生成 fromSources/joins payload
utils/sql_parser/table_parser.cpp 新增 ALTER COLUMN ...RENAME COLUMN 的解析分支
utils/sql_parser/sql_tokenizer.h 新增 JOIN 相关 TokenType
utils/sql_parser/sql_tokenizer.cpp JOIN 相关关键字识别
utils/logic/logic_parser.cpp 相关子查询 outer 引用收集逻辑调整以支持外层别名
controller/sql_dispatcher.cpp 局部 ALTER COLUMN 分发;单表 SELECT 名字解析(投影别名、限定列、ORDER BY 别名)
controller/nest_query.cpp 多表 SELECT 执行(JOIN/逗号 FROM)、多表名字解析与投影/排序/limit
tests/test_parser_dispatcher.cpp 新增/扩展 parser+dispatcher 集成测试覆盖别名、多表 FROM/JOIN、局部 ALTER COLUMN
tests/test_logic.cpp outer 引用收集行为更新与新增用例
tests/TEST_PLAN.md 更新测试覆盖说明
tests/parserNdispatcher_test_plan.md 更新 parser/dispatcher 回归范围说明
PARTIAL_ALTER_PATCH_PLAN.md 局部 ALTER COLUMN 方案文档
FROM_MULTI_PLAN.md 多表 FROM/JOIN 方案文档
ALIAS_PATCH_PLAN.md 单表 alias 能力方案文档

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread utils/logic/logic_parser.cpp Outdated
Comment thread utils/logic/logic_parser.cpp
Comment thread controller/nest_query.cpp Outdated
Comment thread utils/sql_parser/table_parser.cpp
 - 相关子查询现改成同时看 fromSources 和各个 JOIN ... ON。
 - 多表 RIGHT/FULL JOIN 在左侧为空时,补了左侧列的空值模板。
  - ALTER TABLE 解析现会拒绝尾部多余 token,并且不再吞掉未知列段内容。
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Comment thread controller/nest_query.cpp
Comment thread utils/sql_parser/tuple_parser.cpp
Comment thread utils/sql_parser/table_parser.cpp Outdated
  - 避免了 self join 中表名限定列静默错绑;
  - 拒绝 JOIN ON 后拼接非法 FROM 项;
  - 严格校验 ALTER COLUMN TYPE 长度语法;
  - 补充审查边界回归用例。
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment thread utils/sql_parser/tuple_parser.cpp Outdated
Comment thread utils/sql_parser/tuple_parser.cpp Outdated
Comment thread controller/nest_query.cpp Outdated
Comment thread controller/nest_query.cpp
  - self join 只允许通过别名访问重复表,避免表名限定列错绑;
  - alias 不允许撞同一 FROM 作用域内的真实表名;
  - SELECT 标识符规则与 DDL 保持一致,不再接受类型关键字;
  - JOIN ON 后的非法 FROM 项会被明确拒绝;
  - ALTER COLUMN TYPE 长度参数改为严格单整数校验;
  - 补充对应回归用例。
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Comment thread controller/nest_query.cpp
Comment thread utils/logic/logic_parser.cpp Outdated
Comment thread controller/sql_dispatcher.cpp
- JOIN ON 评估前补齐唯一裸列名
- 限定外层引用不再 fallback 到裸列
- partial ALTER 缺少必要 payload 字段时直接拒绝
- 补充 JOIN 绑定和 ALTER 缺字段回归用例
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ChesterNotChest
Copy link
Copy Markdown
Owner Author

@LucidDream444 用你的copilot出个审查

@ChesterNotChest ChesterNotChest merged commit 86306da into master May 17, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants