summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/complete/sql_complete_ut.cpp
diff options
context:
space:
mode:
authorvityaman <[email protected]>2025-04-30 12:58:42 +0300
committerrobot-piglet <[email protected]>2025-04-30 13:22:03 +0300
commit92d6162267a49773e5f40d0a0130edf6ca27624b (patch)
tree0cb3ed3ba1de7d3b1cb153965eaa260f6788a892 /yql/essentials/sql/v1/complete/sql_complete_ut.cpp
parente4b9d7d82d82678e9450fe7085a94149867613a5 (diff)
YQL-19747 Introduce Union and split Static NameServices
Essentially we need the `UnionNameService` to integrate dynamic name services into the `sql/v1/complete`. This decorator queries multiple name services and merges their responses. We will use it to union static `NameServices` and the `SchemaNameService` (and the `ClusterNameService`, and so on). It does not deal with exceptions and fails the whole request on some subtask failed. Client should prepare robust children (later `SwallowingNameService` will be added to return an empty `NameResponse` on errors to provide best-effort dynamic object loading). `StaticNameService` was split into micro-`NameService`s :) `NameConstraints` are extracted to provide name qualification via `Qualified` and `Unqualified` methods. This is needed because depending on a context `NameService` can return unqualified names (for example, on `PRAGMA yt.#`). As internal indexes for scanning and ranking are built on a sorted list of, then `Ranking` actually needs an ability to get fully-qualified names, so now it via the `NameConstraints`. Also this design potentially let us to improve internal indexes by using partitioning by a namespace. Other option was to make `PragmaName` and `FunctionName` more structured via adding a separate field for a namespace, but it seems to me that it will force to do more parsing from indexes results to a `Name`. Anyway this is an internal component so it can be changed if needed. I still doubt this decision because structured `PragmaName { Namespace, Identifier }` seems to be cleaner and there should be no noticeable overhead because of COW strings. --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1252 commit_hash:e8a1fbb17e2ca3ffe72aafbea943a38624d74491
Diffstat (limited to 'yql/essentials/sql/v1/complete/sql_complete_ut.cpp')
-rw-r--r--yql/essentials/sql/v1/complete/sql_complete_ut.cpp7
1 files changed, 7 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 54bcc35233f..c893479ffed 100644
--- a/yql/essentials/sql/v1/complete/sql_complete_ut.cpp
+++ b/yql/essentials/sql/v1/complete/sql_complete_ut.cpp
@@ -303,6 +303,13 @@ Y_UNIT_TEST_SUITE(SqlCompleteTests) {
{
TVector<TCandidate> expected = {
{PragmaName, "yson.CastToString"}};
+ auto completion = engine->CompleteAsync({"PRAGMA ys"}).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(completion.Candidates, expected);
+ UNIT_ASSERT_VALUES_EQUAL(completion.CompletedToken.Content, "ys");
+ }
+ {
+ TVector<TCandidate> expected = {
+ {PragmaName, "yson.CastToString"}};
auto completion = engine->CompleteAsync({"PRAGMA yson"}).GetValueSync();
UNIT_ASSERT_VALUES_EQUAL(completion.Candidates, expected);
UNIT_ASSERT_VALUES_EQUAL(completion.CompletedToken.Content, "yson");