Fix signed number after ')' or ']' being lexed as a literal - #287
Merged
git-hulk merged 1 commit intoJul 29, 2026
Merged
Conversation
…p#286) `Lexer.hasPrecedenceToken` decides whether a `+`/`-` is a sign or a binary operator by looking at the previous token, but its set omitted the closing brackets. `(1)-1` and `arr[1]-1` therefore lexed `-1` as a signed literal, leaving two adjacent expressions with no operator, so valid ClickHouse SQL was rejected. Add `TokenKindRParen` and `TokenKindRBracket` to the set, since a closing bracket ends an expression just like an identifier or a number does.
aftership-abas
self-requested a review
July 29, 2026 09:03
therealpandey
force-pushed
the
fix/signed-number-after-bracket
branch
from
July 29, 2026 09:03
0810bdc to
1d7f2d2
Compare
Member
|
@therealpandey Thank you! |
Contributor
Author
|
That's an amazing turnaround time @git-hulk! You'll be seeing more of me in this repo :). I'll follow the same process:
|
Member
|
@therealpandey Thanks! As a SigNoz user, I'm very happy and honored to see this happen. Looks forward to your contributions! |
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.
Fixes #286.
The lexer decides whether
+/-is a sign or a binary operator by looking at the previous token, but the set of tokens that can end an expression didn't include)or]. SoSELECT (1)-1lexed-1as a signed literal and the parser saw two expressions with no operator between them, rejecting SQL that ClickHouse accepts.Added
TokenKindRParenandTokenKindRBracketto that set, plus a test and a fixture covering the paren, array-index and function-call forms.+/-after an opening bracket is still treated as a sign, soarr[-1]is unchanged. No existing golden files changed.