airborne12 opened a new pull request, #68701:
URL: https://github.com/apache/doris/pull/68701
### 问题
tokenize 的第二个参数通过 NereidsParser.parseProperties 解析。此前该入口仅匹配
propertyItemList,没有要求消费完整输入,导致合法属性后的非法 token 被静默忽略。例如:
```sql
SELECT tokenize('alpha beta', '"parser" = "unicode" trailing_tokens');
```
上述输入此前被接受,可能掩盖属性拼写或拼接错误。
### 改动
- 新增 propertyItemListWithEof 独立解析规则,要求属性列表后紧接 EOF,并让 parseProperties 使用该入口。
- 保留 SQL 内嵌 propertyItemList 的既有语法。合法单项、多项属性,以及末尾空白和注释仍可正常解析。
- 非法尾随标识符、分号、右括号、特殊符号或缺少逗号的属性被拒绝;tokenize 返回既有的属性格式错误。
- 补充 parser、Tokenize 单元测试及 test_tokenize 回归套件中的两个异常用例。
### 测试
- 修复前:`bash run-fe-ut.sh --run
'org.apache.doris.nereids.parser.NereidsParserTest#testParsePropertiesRejectsTrailingTokens'`
按预期失败:期望 ParseException,但没有抛出异常,确认复现。
- 修复后:`bash run-fe-ut.sh --run
'org.apache.doris.nereids.parser.NereidsParserTest,org.apache.doris.nereids.trees.expressions.functions.scalar.TokenizeTest'`
成功;共 96 项测试,失败、错误、跳过均为 0。
- `bash build.sh --fe` 成功,Checkstyle 零违规。
- `git diff --check` 通过;使用共享英文检查器的扫描逻辑检查相对 master 的完整工作区差异,无非英文描述。
- 新增回归用例尚未在集群运行,未手写或修改回归结果文件。
### 行为变化
含非法尾随 token 的 tokenize 属性字符串由静默接受变为明确报错。合法属性行为不变,无需文档变更。
### 提交范围
目标为 apache/doris:master。工作区仅有 5 个相关源码/测试文件的改动,未执行 git commit、push 或 gh pr
create;请由平台提交、推送至 fork 并创建 PR。提交后发布前,请对实际提交执行共享 pr_english_check.py(--base
master --head 提交SHA);本轮遵照要求没有创建提交。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]