Skip to content

fix(mysql): enable window function parsing in ParseOneSql - #3369

Merged
iwanghc merged 1 commit into
mainfrom
sqle/fix-3110
Aug 26, 2026
Merged

iwanghc merged 1 commit into
mainfrom
sqle/fix-3110

Conversation

@LordofAvernus

@LordofAvernus LordofAvernus commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

User description

Related issue

https://github.com/actiontech/sqle-ee/issues/3110

Changes

  • Enable EnableWindowFunc(true) in ParseOneSql to align SQL analysis entry with audit splitter
  • Add TestParseOneSqlWindowFunc to verify window function AST parsing

Background

SQL analysis page fails to parse MySQL 8 window functions (ROW_NUMBER() OVER (PARTITION BY ...)) with parser error near "( PARTITION BY". The audit path already enables window function parsing via splitter.NewSplitter(), but ParseOneSql did not.

Made with Cursor


Description

  • 在 ParseOneSql 中启用窗口函数解析

  • 新增测试验证 AST 包含 WindowFuncExpr

  • 修复 MySQL 8 窗口函数解析错误


Diagram Walkthrough

flowchart LR
  A["启用窗口函数解析"]
  B["新增测试验证"]
  C["修复MySQL解析错误"]
  A -- "触发" --> B
  B -- "修复" --> C
Loading

File Walkthrough

Relevant files
Bug fix
parser_helper.go
启用窗口函数解析支持                                                                                             

sqle/driver/mysql/util/parser_helper.go

  • 新增 p.EnableWindowFunc(true) 语句
  • 调整解析流程以支持窗口函数解析
+1/-0     
Tests
parser_helper_test.go
添加窗口函数解析测试                                                                                             

sqle/driver/mysql/util/parser_helper_test.go

  • 添加 TestParseOneSqlWindowFunc 测试用例
  • 验证 AST 包含 WindowFuncExpr
+20/-0   

Align SQL analysis entry with audit splitter by enabling
EnableWindowFunc(true) in ParseOneSql, fixing parser failures
for ROW_NUMBER() OVER (PARTITION BY ...) SQL.

Add TestParseOneSqlWindowFunc to verify AST contains WindowFuncExpr.

Fixes actiontech/sqle-ee#3110

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@iwanghc
iwanghc merged commit 44e88c4 into main Aug 26, 2026
4 checks passed
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