Conversation
Signed-off-by: 付典 <fudianchn@gmail.com>
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.
AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me.
What
TablesNamesFinder now visits omitted array subscripts, named function arguments, analytic partitions, initial piped-query joins and lateral views, UPSERT duplicate actions, IF conditions and OUTPUT destinations. MERGE uses the existing OUTPUT traversal shared by INSERT, UPDATE and DELETE.
Why
SELECT a[(SELECT max(x) FROM t2)] FROM t1returns onlyt1on the base commit instead oft1andt2. Array slices such asa[OFFSET(1):2]can throw a NullPointerException during table extraction.How
Root cause
Several visitor overrides omit already-parsed child fields. ArrayExpression checks the start bound before dereferencing the single index, which skips ordinary subscripts and dereferences a null index for slices.
Testing
bb55bb9d, 39 fail and 26 normal controls pass; the fix passes all 65. Static, instance, expression and other-source entry points are covered. Four isolated mutations are rejected by the tests../gradlew checkpasses with 9467 cases, zero failures/errors and 25 skipped;mvn clean verifypasses with 9449 cases, zero failures/errors and 25 skipped. Formatting, Checkstyle, PMD, SpotBugs, grammar ambiguity, applicable coverage and changed-file license checks pass.JSQLParserBenchmark.parseSQLStatements, unchanged 54-statement corpus,version=latest: interleaved baseline/fixed, 3 forks per state, 2 one-second warmups and 5 one-second measurements per fork. Baseline 27.875 ms/op, 99.9% CI [21.312,34.438]; fixed 27.890 ms/op, CI [21.270,34.510], 15 samples per state. The intervals overlap. This parsing benchmark does not exercise TablesNamesFinder.Behavior notes
f()[1:2]retains its JsonExpression index reading as a normal control; this change does not fix JSON-path grammar or traversal.Verification of the original issue
No existing issue is linked. The failures were reproduced on upstream master
bb55bb9de8377de9880b14e4fe3b3cc94bf63498; the fixed commit is8f7de28c5a72316ac72d41acf74211f1d34e8dba. This builds on #2479, #2517 and #2538, covering child fields that those changes did not address.The first two return
t1andt2with the fix. The slice returnst1without throwing. The same families are tested through statement and expression entry points.