perf(mysql): avoid full parse for ordinary completion scripts - #2865
Merged
Merged
Conversation
openai0229
force-pushed
the
fix/sql-completion-performance
branch
from
September 2, 2026 05:47
9ac654e to
acda89b
Compare
openai0229
force-pushed
the
fix/sql-completion-performance
branch
from
September 2, 2026 05:50
acda89b to
4e894c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
N/A - no issue number was provided.
Summary
Avoids parsing the entire MySQL editor script with the ANTLR root parser when lexer boundaries prove that the input is a balanced ordinary SQL script. Complex routines, DELIMITER scripts, malformed input, and ambiguous no-semicolon statements keep the existing parser/probe path. Adds boundary coverage and a large-SQL performance test for 200-line scripts and 166/500/1000-value IN lists.
Affected surfaces
Verification
mvn -B -f chat2db-community-server/pom.xml -pl :chat2db-community-mysql -am -Dmaven.test.skip=false -DskipTests=false -Dtest='MysqlSqlCompletionProviderTest,MysqlSqlCompletionScenarioCoverageTest,MysqlSqlCompletionStatementProgressionTest,MysqlSqlCompletionDdlScenarioCoverageTest,MysqlSqlCompletionRuleRangeTest,MysqlSqlCompletionStatementLocatorTest,MysqlSqlCompletionPerformanceTest' -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.test.failure.ignore=false test- 521 tests passed, 0 failures, 0 errors.git diff --check- passed.Risk and compatibility
Reviewer map
chat2db-community-server/chat2db-community-plugins/chat2db-community-mysql/src/main/java/ai/chat2db/plugin/mysql/completion/locate/MysqlSqlCompletionStatementLocator.javacanUseTokenWindowrequires balanced parentheses, no CREATE/DELIMITER tokens, no unsafe lexer errors, and a proven separator or single top-level statement; otherwise the existing parser/probe path runs.Contributor declaration
AI assistance: Substantial AI assistance was used for code navigation, implementation, test design, performance measurement, and verification.