aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/complete/core/input.cpp
diff options
context:
space:
mode:
authorvityaman <vityaman.dev@yandex.ru>2025-05-06 15:49:02 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2025-05-06 16:04:08 +0300
commit9c3fdca51d8ae892c5ad8f6ef92df73fafc09e28 (patch)
tree561c599fae4ea29b537a6958b65e1b052548edf2 /yql/essentials/sql/v1/complete/core/input.cpp
parentc131e959456f9f9a4adada5623ce3bae4097a8c1 (diff)
downloadydb-9c3fdca51d8ae892c5ad8f6ef92df73fafc09e28.tar.gz
YQL-19747 Complete folder, table and cluster names
--- - Related to `YQL-19747` - On top of https://github.com/ytsaurus/ytsaurus/pull/1253 - Related to https://github.com/ydb-platform/ydb/issues/9056 - Related to https://github.com/vityaman/ydb/issues/14 - Related to https://github.com/vityaman/ydb/issues/35 - Related to https://github.com/vityaman/ydb/issues/40 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1257 commit_hash:0b842abb27184c88b8177beeea29fb1ea86b7a04
Diffstat (limited to 'yql/essentials/sql/v1/complete/core/input.cpp')
-rw-r--r--yql/essentials/sql/v1/complete/core/input.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/yql/essentials/sql/v1/complete/core/input.cpp b/yql/essentials/sql/v1/complete/core/input.cpp
new file mode 100644
index 00000000000..8eca3a28ee8
--- /dev/null
+++ b/yql/essentials/sql/v1/complete/core/input.cpp
@@ -0,0 +1,25 @@
+#include "input.h"
+
+#include <util/generic/yexception.h>
+
+namespace NSQLComplete {
+
+ TCompletionInput SharpedInput(TString& text) {
+ constexpr char delim = '#';
+
+ size_t pos = text.find_first_of(delim);
+ if (pos == TString::npos) {
+ return {
+ .Text = text,
+ };
+ }
+
+ Y_ENSURE(!TStringBuf(text).Tail(pos + 1).Contains(delim));
+ text.erase(std::begin(text) + pos);
+ return {
+ .Text = text,
+ .CursorPosition = pos,
+ };
+ }
+
+} // namespace NSQLComplete