Skip to content

Commit

Permalink
Fix WITH statement for INDEX (#1010)
Browse files Browse the repository at this point in the history
  • Loading branch information
UgnineSirdis authored Jan 15, 2024
1 parent d5ecd72 commit 8d9c052
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ydb/library/yql/sql/v1/SQLv1.g.in
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ table_constraint:
;

table_index: INDEX an_id table_index_type
(WITH LPAREN an_id EQUALS an_id COMMA (an_id EQUALS an_id)* RPAREN)?
(WITH LPAREN an_id EQUALS an_id (COMMA an_id EQUALS an_id)* COMMA? RPAREN)?
ON LPAREN an_id_schema (COMMA an_id_schema)* RPAREN
(COVER LPAREN an_id_schema (COMMA an_id_schema)* RPAREN)?;

Expand Down
9 changes: 7 additions & 2 deletions ydb/library/yql/sql/v1/sql_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2359,6 +2359,11 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) {
UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table SET (AUTO_PARTITIONING_BY_SIZE = DISABLED)").IsOk());
}

Y_UNIT_TEST(AlterTableAddIndexWithIsNotSupported) {
ExpectFailWithError("USE plato; ALTER TABLE table ADD INDEX idx LOCAL WITH (a=b, c=d, e=f) ON (col)",
"<main>:1:40: Error: local: alternative is not implemented yet: 692:7: local_index\n");
}

Y_UNIT_TEST(OptionalAliases) {
UNIT_ASSERT(SqlToYql("USE plato; SELECT foo FROM (SELECT key foo FROM Input);").IsOk());
UNIT_ASSERT(SqlToYql("USE plato; SELECT a.x FROM Input1 a JOIN Input2 b ON a.key = b.key;").IsOk());
Expand Down Expand Up @@ -6134,7 +6139,7 @@ Y_UNIT_TEST_SUITE(TViewSyntaxTest) {
);
UNIT_ASSERT_C(res.Root, res.Issues.ToString());
}

Y_UNIT_TEST(CreateViewFromTable) {
constexpr const char* path = "/PathPrefix/TheView";
constexpr const char* query = R"(
Expand Down Expand Up @@ -6178,7 +6183,7 @@ Y_UNIT_TEST_SUITE(TViewSyntaxTest) {
)
);
UNIT_ASSERT_C(res.Root, res.Issues.ToString());

TString reconstructedQuery = ToString(Tokenize(query));
TVerifyLineFunc verifyLine = [&](const TString& word, const TString& line) {
if (word == "query_text") {
Expand Down

0 comments on commit 8d9c052

Please sign in to comment.