Repository navigation
Parse a tuple element index after a qualified column - #344
Open
sharadgaur wants to merge 1 commit into
Open
sharadgaur wants to merge 1 commit into
sharadgaur wants to merge 1 commit into
Conversation
t.col.1 reads element 1 of the tuple column col of table t. The path parser consumed the dot and then expected another name, so a qualified column could not be followed by an element index. An unqualified col.1 already worked.
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.
Summary
A tuple element can be read by index after a column,
col.1. That workedfor an unqualified column but not for a qualified one:
The path parser consumed the dot after
aand then required anothername. It now stops when a number follows the dot, and the existing index
operation reads
.1.Validation against ClickHouse
Checked with
clickhouse local26.2.1 usingformatQuery. Eachformatted output was fed back to ClickHouse and parses.
SELECT t.a.1 FROM tSELECT db.t.a.1 FROM db.tSELECT t.a.1 + 1 FROM t, also in WHERE and ORDER BYSELECT f((t.a[1]).1, u.b.1) FROM t, uSELECT a.1 FROM t,(a[1]).1,a[1].1,tuple(1, 2).1SELECT t.a.b FROM t,t.a.:Int64SELECT t.a.1.:Int64 FROM tChanges
parseIdentOrFunction.The result is an
IndexOperationover thePath, the same shapea.1already produces over anIdent.No AST, visitor, walk or formatter change.
Not in this PR
a.1.2ort.a.1.2, is still rejected. ClickHouseparses it as
(a.1).2. The lexer reads1.2as one number there.Tests
testdata/query/select_tuple_element_of_qualified_column.sqlTestParser_InvalidSyntax.make testpasses.golangci-lintv1.53.3 (the CI version) reports nothing.