<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/yql/essentials/sql/v1/complete/sql_complete.h, branch CLI_2.22.0</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=CLI_2.22.0</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=CLI_2.22.0'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2025-06-02T10:49:48Z</updated>
<entry>
<title>YQL-19747: Complete named expressions</title>
<updated>2025-06-02T10:49:48Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-06-02T10:23:33Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=f8dd75681a31f8b883f1c69db243a1ded8bb8d94'/>
<id>urn:sha1:f8dd75681a31f8b883f1c69db243a1ded8bb8d94</id>
<content type='text'>
- Introduced scoped name collection at global analysis
- Added `BingingsNameService` constructed after global analysis and united with the base service.
- Added dollar detection at local analysis.

After this point design should be reexamined and module should be refactored.

---

- Related to `YQL-19747`
- Related to https://github.com/ydb-platform/ydb/issues/9056
- Related to https://github.com/vityaman/ydb/issues/57

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1304
commit_hash:a7bf41703f0ee846e359407b53a5d62fc05928ea
</content>
</entry>
<entry>
<title>YQL-19747: Support cursor shifting on completion</title>
<updated>2025-05-28T14:13:12Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-05-28T13:35:18Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=d84972b06e6d5e001155d1be72189c6a2ef7e7ac'/>
<id>urn:sha1:d84972b06e6d5e001155d1be72189c6a2ef7e7ac</id>
<content type='text'>
Completion candidates comes unclosed from right and with zeroed `CursorShift`. In future there will be an atomic patch that will close candidates and set `CursorShift` correctly. Not it is zeroed to integrate with clients (e.g. YDB CLI).

---

- Related to `YQL-19747`
- Related to https://github.com/vityaman/ydb/issues/53
- Related to https://github.com/ydb-platform/ydb/issues/9056

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1299

Co-authored-by: vvvv &lt;vvvv@yandex-team.com&gt;
commit_hash:38bcd21f0d6959275af89a981fd9b296374aea51
</content>
</entry>
<entry>
<title>YQL-19747: Support immediate string named expressions</title>
<updated>2025-05-27T09:09:17Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-05-27T08:56:16Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=04c43eb2d8297ffe7b7b7a5b4ca48980d01fca96'/>
<id>urn:sha1:04c43eb2d8297ffe7b7b7a5b4ca48980d01fca96</id>
<content type='text'>
---
- Related to `YQL-19747`
- Related to https://github.com/vityaman/ydb/issues/50

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1292
commit_hash:a6d543bc18b2f9239bf0b33afd8497a7919fe4b3
</content>
</entry>
<entry>
<title>YQL-19747: Support statement blacklist</title>
<updated>2025-05-23T15:56:51Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-05-23T15:39:07Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=7c0f642f72f590d66d364c59e77ab1a7e4d7fcf2'/>
<id>urn:sha1:7c0f642f72f590d66d364c59e77ab1a7e4d7fcf2</id>
<content type='text'>
I leaved the YDB configuration empty as need your feedback.

---

- Related to `YQL-19747`
- Related to https://github.com/vityaman/ydb/issues/39

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1289
commit_hash:408c7e0f101027fc6ca3d86d251b5639fcae07bb
</content>
</entry>
<entry>
<title>YQL-19747 Complete folder, table and cluster names</title>
<updated>2025-05-06T13:04:08Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-05-06T12:49:02Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=9c3fdca51d8ae892c5ad8f6ef92df73fafc09e28'/>
<id>urn:sha1:9c3fdca51d8ae892c5ad8f6ef92df73fafc09e28</id>
<content type='text'>
---

- 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
</content>
</entry>
<entry>
<title>YQL-19747: Refactor sql/v1/complete usage of Future and Ptr</title>
<updated>2025-04-25T13:30:34Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-04-25T13:08:47Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=2b59203eb9ccded916b53b3410e3f15abf4b623f'/>
<id>urn:sha1:2b59203eb9ccded916b53b3410e3f15abf4b623f</id>
<content type='text'>
- [x] Chained futures, add `CompleteAsync` method (then will migrate the YDB CLI on it).
- [x] Removed deadlined and fallback NameService as unused
- [x] Annotate thread-safe methods with `const` and use `AtomicSharedPtr` for them.
- [x] Move `name` to `name/service` with backward compatibility with the YDB CLI.

---

`CompletionEngine` is left thread-unsafe because of the dependency chain `CompletionEngine -&gt; LocalSyntaxAnalysis -&gt; C3Engine` which is thread-unsafe, but readonly indexed data structures such as `Ranking` and `NameService` are annotated with const and distributed via shared pointers.

I removed deadlined and fallback name services because the first is stupid the second is ahead of its time and is better to be added later to keep interfaces as minimal as possible.

---

The migration on async complete plan:
1. Introduce CompleteAsync
2. Migrate clients on CompleteAsync
3. Make Complete to return Future
4. Migrate clients on Complete
5. Remove CompleteAsync

---

- Related to https://github.com/ydb-platform/ydb/issues/9056
- Related to https://github.com/vityaman/ydb/issues/33
- Related to https://github.com/vityaman/ydb/issues/31

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1241

Co-authored-by: vvvv &lt;vvvv@yandex-team.com&gt;
Co-authored-by: vvvv &lt;vvvv@yandex-team.com&gt;
commit_hash:497cc081ab78bebf7354e0acfaa418d936cc8240
</content>
</entry>
<entry>
<title>YQL-19747 Detect a token at the caret position</title>
<updated>2025-04-23T12:27:38Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-04-23T12:04:48Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=c222f6f103376934dd705e16bf9a3bad66e44365'/>
<id>urn:sha1:c222f6f103376934dd705e16bf9a3bad66e44365</id>
<content type='text'>
When I tried to implement a folder and object names completion at `ID_QUOTED` I faced with a problem, that I actually can't detect, that cursor is at `ID_QUOTED` token because `TCompletionInput::Text` it was cut until the `TCompletionInput::CursorPosition`, therefore at input ``` SELECT * FROM `#` ``` prefix was ``` SELECT * FROM `# ``` and then lexer failed.

While we actually want tokenize the whole current statement, `C3` still needs to receive a prefix as input. I tried to tokenize the whole statement and then on input `SELECT Optional&lt;#&gt;` got nothing because `&lt;&gt;` is solid token in the `SQL`. The only way to fix it I found is to cut a query to prefix until the cursor position.

BTW, current implementation is not so efficient as we tokenize the input multiple times. Especially `SplitQueryToStatemnts` seems heavy. In future we anyway will parse the whole input so will need to design APIs to receive ready token streams to do statements splitting, for example, just not to do the work twice.

![image](https://github.com/user-attachments/assets/114804d3-f311-4a46-be84-8ed4650bc9dd)

So I introduce you the following changes

- [x] Select the whole current statement, not just prefix.
- [x] Find the token at caret and output no candidates when caret is at `STRING_VALUE`, `DIGIGTS` and so on.
- [x] Change `C3` wrapper interface to take `TCompletionInput` to hide an implementation detail that it runs on cut prefix.
- [x] `#` annotated queries in unit tests.
- [x] Detect `CaretTokenPosition` -- if is it enclosed with a token or between two.
- [x] Ensure that `maxErrors` in `ILexer::Tokenize` is positive. Just a tiny bugfix.

---

- Related to https://github.com/ytsaurus/ytsaurus/pull/1209
- Related to https://github.com/ydb-platform/ydb/issues/9056
- Related to https://github.com/vityaman/ydb/issues/14

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1225
commit_hash:a434b9888ec8a7356247d63d9f1420e256ae4fca
</content>
</entry>
<entry>
<title>YQL-19747 Remove default completion engine factory</title>
<updated>2025-04-15T11:57:48Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-04-15T11:30:08Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=c3eed92629687af94073f570c29ea338bdd66548'/>
<id>urn:sha1:c3eed92629687af94073f570c29ea338bdd66548</id>
<content type='text'>
This is to decouple from the `sql/v1/lexer` implementation.

- Related to https://github.com/ydb-platform/ydb/issues/9056
- Related to https://github.com/vityaman/ydb/issues/18
- Following https://github.com/ydb-platform/ydb/pull/16820

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1196
commit_hash:4995f3a7cb14b0b735a48e211111764f65be8033
</content>
</entry>
<entry>
<title>YQL-19747 Complete select and insert hints</title>
<updated>2025-04-09T15:12:05Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-04-09T14:57:35Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=394fee4aa8d48e58cf82c72bcb9dda0a5dd50190'/>
<id>urn:sha1:394fee4aa8d48e58cf82c72bcb9dda0a5dd50190</id>
<content type='text'>
- Related to https://github.com/ydb-platform/ydb/issues/9056
- Related to https://github.com/vityaman/ydb/issues/19

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1189
commit_hash:7f1cb1dcf0617aa2c94c3f2188fc9bd481380252
</content>
</entry>
<entry>
<title>YQL-19747 Complete after PRAGMA and multi-token names</title>
<updated>2025-04-08T13:26:47Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-04-08T13:11:56Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=2f90258cf6f1625ba0c99f6f37b6c9f336590534'/>
<id>urn:sha1:2f90258cf6f1625ba0c99f6f37b6c9f336590534</id>
<content type='text'>
- [x] Complete after PRAGMA
- [x] Complete multi-token names correctly, for example, `yt.` returns only `DisableStrict`, not `yt.DisableStrict` and `DateTime::` returns `Split`, not `DateTime::Split`.

I tried to implement it using `CompletedToken` edition, but not all completion environments support candidates with various `contextLen` (`Replxx` does not). So I decided that completions should rewrite only the current token, not sequences. For example, on `DateTime::Spl` rewrite only `Spl`. It makes sense as multi-token names have some namespace separated by a punctuation, so used types only namespace and gets names inside of it.

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1181
commit_hash:9d8967ac43b9348f6dbb53837d92a9dcc9b51f48
</content>
</entry>
</feed>
