diff options
author | vitya-smirnov <[email protected]> | 2025-06-17 16:02:41 +0300 |
---|---|---|
committer | vitya-smirnov <[email protected]> | 2025-06-17 16:18:59 +0300 |
commit | 0bc6f0197fa813fec678c75c760564724f591309 (patch) | |
tree | bb40ca81a21ddb608154e56967202c0548708551 /yql/essentials/sql/v1/complete/sql_complete_ut.cpp | |
parent | d84e9cf123d8345dc008b9b0feafbb20be9d9784 (diff) |
YQL-19747: Support token ignoring patterns
Added support for token filtration. It is needed because YQL grammar supports multiple systems with various capabilities. For example, some of those do not support `INTERSECT ALL` and therefore `ALL` after `INTERSECT` should be *disabled*. Another example is a support of an only `EVALUATE FOR`, so `FOR` is *forced* to be precendenced by `EVALUATE`.
commit_hash:a926c8d3911f8dd025ab58eb7f81e2370fcd9376
Diffstat (limited to 'yql/essentials/sql/v1/complete/sql_complete_ut.cpp')
-rw-r--r-- | yql/essentials/sql/v1/complete/sql_complete_ut.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/yql/essentials/sql/v1/complete/sql_complete_ut.cpp b/yql/essentials/sql/v1/complete/sql_complete_ut.cpp index d37d34be06b..1f29751d017 100644 --- a/yql/essentials/sql/v1/complete/sql_complete_ut.cpp +++ b/yql/essentials/sql/v1/complete/sql_complete_ut.cpp @@ -1319,6 +1319,24 @@ JOIN yt:$cluster_name.test; UNIT_ASSERT_UNEQUAL(Complete(engine, {"SELE"}).size(), 0); } + Y_UNIT_TEST(IgnoredTokens) { + auto lexer = MakePureLexerSupplier(); + + TNameSet names; + TFrequencyData frequency; + auto service = MakeStaticNameService(names, MakeDefaultRanking(frequency)); + + auto config = MakeYQLConfiguration(); + auto engine = MakeSqlCompletionEngine(lexer, std::move(service), config); + + UNIT_ASSERT(!FindPtr(Complete(engine, {""}), TCandidate{Keyword, "FOR"})); + UNIT_ASSERT(!FindPtr(Complete(engine, {""}), TCandidate{Keyword, "PARALLEL"})); + + UNIT_ASSERT(FindPtr(Complete(engine, {"EVALUATE "}), TCandidate{Keyword, "FOR"})); + UNIT_ASSERT(FindPtr(Complete(engine, {"EVALUATE "}), TCandidate{Keyword, "FOR"})); + UNIT_ASSERT(FindPtr(Complete(engine, {"EVALUATE /**/"}), TCandidate{Keyword, "FOR"})); + } + Y_UNIT_TEST(CachedSchema) { TLexerSupplier lexer = MakePureLexerSupplier(); |