aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/complete/syntax
diff options
context:
space:
mode:
authorvityaman <vityaman.dev@yandex.ru>2025-05-19 17:36:10 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2025-05-19 17:51:48 +0300
commitf16ede95953f8cdd44e3b762b175bd22e106bb5c (patch)
treec6c7bfbd6e2760b9964e59d97e92807bf909fdcd /yql/essentials/sql/v1/complete/syntax
parent0da4d46798a36e3ac49b2d87bdbb5520e2224551 (diff)
downloadydb-f16ede95953f8cdd44e3b762b175bd22e106bb5c.tar.gz
YQL-19747: Fix unquoted object path completion
On `SELECT * FROM pn` it completed to `SELECT * FROM ppnv1`, but expected ``` SELECT * FROM `pnv1` ```. --- - Related to `YQL-19747` - Related to https://github.com/ydb-platform/ydb/issues/9056 - Related to https://github.com/vityaman/ydb/issues/44 - Related to https://github.com/ydb-platform/ydb/pull/18146 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1280 commit_hash:e937239fae7bf609bde6358b9b27c2b504c8ba32
Diffstat (limited to 'yql/essentials/sql/v1/complete/syntax')
-rw-r--r--yql/essentials/sql/v1/complete/syntax/local.cpp9
-rw-r--r--yql/essentials/sql/v1/complete/syntax/local.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/yql/essentials/sql/v1/complete/syntax/local.cpp b/yql/essentials/sql/v1/complete/syntax/local.cpp
index c20b67d2042..d461cd41523 100644
--- a/yql/essentials/sql/v1/complete/syntax/local.cpp
+++ b/yql/essentials/sql/v1/complete/syntax/local.cpp
@@ -234,7 +234,11 @@ namespace NSQLComplete {
if (auto path = ObjectPath(context)) {
object.Path = *path;
- object.IsEnclosed = true;
+ }
+
+ if (auto enclosing = context.Enclosing();
+ enclosing.Defined() && enclosing->Base->Name == "ID_QUOTED") {
+ object.IsQuoted = true;
}
return object;
@@ -245,8 +249,9 @@ namespace NSQLComplete {
TString path = enclosing->Base->Content;
if (enclosing->Base->Name == "ID_QUOTED") {
path = Unquoted(std::move(path));
+ enclosing->Position += 1;
}
- path.resize(context.Cursor.Position - enclosing->Position - 1);
+ path.resize(context.Cursor.Position - enclosing->Position);
return path;
}
return Nothing();
diff --git a/yql/essentials/sql/v1/complete/syntax/local.h b/yql/essentials/sql/v1/complete/syntax/local.h
index 8f88d5aa71c..9675eb9e843 100644
--- a/yql/essentials/sql/v1/complete/syntax/local.h
+++ b/yql/essentials/sql/v1/complete/syntax/local.h
@@ -41,7 +41,7 @@ namespace NSQLComplete {
TString Cluster;
TString Path;
THashSet<EObjectKind> Kinds;
- bool IsEnclosed = false;
+ bool IsQuoted = false;
};
TKeywords Keywords;