diff options
| author | vitya-smirnov <[email protected]> | 2025-06-17 12:44:39 +0300 |
|---|---|---|
| committer | vitya-smirnov <[email protected]> | 2025-06-17 13:00:42 +0300 |
| commit | bacec6cbd87d14bf55c256f17797537ae8c2bbed (patch) | |
| tree | 0e4cfe7c9e0fe96ff92a084d9a5ba75006137c9b /yql/essentials/sql/v1/complete/sql_complete_ut.cpp | |
| parent | 73c773ee1bd8078646b72379ffe7626101c8cb56 (diff) | |
YQL-19747: Improve types completion
Instead of relying on keyword sequences provided by C3 and using hacks like pattern matching on keyword sequences (`format.cpp`), emit composite types manually.
commit_hash:999d8d4b514433fbdf7885aa0122b2010e985efb
Diffstat (limited to 'yql/essentials/sql/v1/complete/sql_complete_ut.cpp')
| -rw-r--r-- | yql/essentials/sql/v1/complete/sql_complete_ut.cpp | 93 |
1 files changed, 49 insertions, 44 deletions
diff --git a/yql/essentials/sql/v1/complete/sql_complete_ut.cpp b/yql/essentials/sql/v1/complete/sql_complete_ut.cpp index 4ecc12e526f..878897a3844 100644 --- a/yql/essentials/sql/v1/complete/sql_complete_ut.cpp +++ b/yql/essentials/sql/v1/complete/sql_complete_ut.cpp @@ -475,37 +475,40 @@ Y_UNIT_TEST_SUITE(SqlCompleteTests) { TVector<TCandidate> expected = { {Keyword, "ALL"}, {Keyword, "BITCAST("}, - {Keyword, "CALLABLE"}, {Keyword, "CASE"}, {Keyword, "CAST("}, {Keyword, "CURRENT_DATE"}, {Keyword, "CURRENT_TIME"}, {Keyword, "CURRENT_TIMESTAMP"}, - {Keyword, "Dict<"}, + {TypeName, "Callable<"}, {Keyword, "DISTINCT"}, {FunctionName, "DateTime::Split("}, + {TypeName, "Decimal("}, + {TypeName, "Dict<"}, {Keyword, "EMPTY_ACTION"}, - {Keyword, "ENUM"}, {Keyword, "EXISTS("}, + {TypeName, "Enum<"}, {Keyword, "FALSE"}, - {Keyword, "Flow<"}, + {TypeName, "Flow<"}, {Keyword, "JSON_EXISTS("}, {Keyword, "JSON_QUERY("}, {Keyword, "JSON_VALUE("}, - {Keyword, "List<"}, + {TypeName, "List<"}, {Keyword, "NOT"}, {Keyword, "NULL"}, - {Keyword, "Optional<"}, + {TypeName, "Optional<"}, {FunctionName, "Python::__private("}, - {Keyword, "Resource<"}, - {Keyword, "Set<"}, + {TypeName, "Resource<"}, {Keyword, "STREAM"}, - {Keyword, "STRUCT"}, + {TypeName, "Set<"}, {FunctionName, "StartsWith("}, - {Keyword, "Tagged<"}, + {TypeName, "Stream<"}, + {TypeName, "Struct<"}, {Keyword, "TRUE"}, - {Keyword, "TUPLE"}, - {Keyword, "VARIANT"}, + {TypeName, "Tagged<"}, + {TypeName, "Tuple<"}, + {TypeName, "Uint64"}, + {TypeName, "Variant<"}, }; auto engine = MakeSqlCompletionEngineUT(); @@ -689,8 +692,8 @@ Y_UNIT_TEST_SUITE(SqlCompleteTests) { {Keyword, "ANY"}, }; UNIT_ASSERT_VALUES_EQUAL(Complete(engine, R"( - USE example; - DEFINE ACTION $hello() AS + USE example; + DEFINE ACTION $hello() AS USE yt:saurus; SELECT * FROM #; END DEFINE; @@ -721,36 +724,38 @@ Y_UNIT_TEST_SUITE(SqlCompleteTests) { Y_UNIT_TEST(SelectWhere) { TVector<TCandidate> expected = { {Keyword, "BITCAST("}, - {Keyword, "CALLABLE"}, {Keyword, "CASE"}, {Keyword, "CAST("}, {Keyword, "CURRENT_DATE"}, {Keyword, "CURRENT_TIME"}, {Keyword, "CURRENT_TIMESTAMP"}, - {Keyword, "Dict<"}, + {TypeName, "Callable<"}, {FunctionName, "DateTime::Split("}, + {TypeName, "Decimal("}, + {TypeName, "Dict<"}, {Keyword, "EMPTY_ACTION"}, - {Keyword, "ENUM"}, {Keyword, "EXISTS("}, + {TypeName, "Enum<"}, {Keyword, "FALSE"}, - {Keyword, "Flow<"}, + {TypeName, "Flow<"}, {Keyword, "JSON_EXISTS("}, {Keyword, "JSON_QUERY("}, {Keyword, "JSON_VALUE("}, - {Keyword, "List<"}, + {TypeName, "List<"}, {Keyword, "NOT"}, {Keyword, "NULL"}, - {Keyword, "Optional<"}, + {TypeName, "Optional<"}, {FunctionName, "Python::__private("}, - {Keyword, "Resource<"}, - {Keyword, "Set<"}, - {Keyword, "Stream<"}, - {Keyword, "STRUCT"}, + {TypeName, "Resource<"}, + {TypeName, "Set<"}, {FunctionName, "StartsWith("}, - {Keyword, "Tagged<"}, + {TypeName, "Stream<"}, + {TypeName, "Struct<"}, {Keyword, "TRUE"}, - {Keyword, "TUPLE"}, - {Keyword, "VARIANT"}, + {TypeName, "Tagged<"}, + {TypeName, "Tuple<"}, + {TypeName, "Uint64"}, + {TypeName, "Variant<"}, }; auto engine = MakeSqlCompletionEngineUT(); @@ -791,21 +796,21 @@ Y_UNIT_TEST_SUITE(SqlCompleteTests) { Y_UNIT_TEST(TypeName) { TVector<TCandidate> expected = { - {Keyword, "Callable<("}, - {Keyword, "Decimal("}, - {Keyword, "Dict<"}, - {Keyword, "Enum<"}, - {Keyword, "Flow<"}, - {Keyword, "List<"}, - {Keyword, "Optional<"}, - {Keyword, "Resource<"}, - {Keyword, "Set<"}, - {Keyword, "Stream<"}, - {Keyword, "STRUCT"}, - {Keyword, "Tagged<"}, - {Keyword, "TUPLE"}, + {TypeName, "Callable<"}, + {TypeName, "Decimal("}, + {TypeName, "Dict<"}, + {TypeName, "Enum<"}, + {TypeName, "Flow<"}, + {TypeName, "List<"}, + {TypeName, "Optional<"}, + {TypeName, "Resource<"}, + {TypeName, "Set<"}, + {TypeName, "Stream<"}, + {TypeName, "Struct<"}, + {TypeName, "Tagged<"}, + {TypeName, "Tuple<"}, {TypeName, "Uint64"}, - {Keyword, "Variant<"}, + {TypeName, "Variant<"}, }; auto engine = MakeSqlCompletionEngineUT(); @@ -825,7 +830,7 @@ Y_UNIT_TEST_SUITE(SqlCompleteTests) { } { TVector<TCandidate> expected = { - {Keyword, "Optional<"}, + {TypeName, "Optional<"}, }; UNIT_ASSERT_VALUES_EQUAL(Complete(engine, "SELECT Nothing(Option"), expected); } @@ -995,7 +1000,7 @@ Y_UNIT_TEST_SUITE(SqlCompleteTests) { $=0; $a=0; $abac=0; - SELECT + SELECT )"; { @@ -1065,7 +1070,7 @@ SELECT 123467, \"Hello, {name}! 编码\"}, (1 + (5 * 1 / 0)), MIN(identifier), Bool(field), Math::Sin(var) -FROM `local/test/space/table` +FROM `local/test/space/table` JOIN yt:$cluster_name.test; )"; |
