Conversation
keywordCase upper was rewriting range() to RANGE (), which ClickHouse rejects. Remap RANGE + OPEN_PAREN the same way SET(100) is remapped, and leave RANGE BETWEEN as a window-frame keyword phrase.
This branch has not been deployed
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.
Remap ClickHouse
RANGEto a function name when the next token is(. ClickHouse function names are case-sensitive. WithkeywordCase: "upper",SELECT range(32)staysrange(32)instead ofRANGE (32), which ClickHouse rejects:Fixes #980.
RANGEis a reserved keyword.range()is omitted from the functions list because RANGE is also a window-frame word.postProcessalready remapsSET(100)to a function name when the next token is(. RANGE now uses that same neighbour check. DefaultfunctionCaseispreserve, so the originalrangespelling is kept.{ROWS | RANGE} BETWEENremains a reserved keyword phrase, so window frames are unchanged.Alternative: add
rangetoclickhouse.functions.ts. That would letfuncNameToIdentturn bare RANGE into an identifier (for exampleRANGE UNBOUNDED PRECEDING) and would fight the existing comment on the functions list. Happy to switch if that is preferred.Test plan
SELECT range(32)withkeywordCase: "upper"keepsrange(32)RANGE BETWEENin a window frame still formats as a keyword phrasetest/clickhouse.test.ts)