<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/yql/essentials/sql/v1/complete/syntax/ya.make, branch CLI_2.21.0</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=CLI_2.21.0</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=CLI_2.21.0'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2025-05-06T13:04:08Z</updated>
<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 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 Rank keywords just by plain usages</title>
<updated>2025-04-14T10:40:02Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-04-14T10:06:15Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=14005fcfba8efa6918e54d823bff6780d9922f8f'/>
<id>urn:sha1:14005fcfba8efa6918e54d823bff6780d9922f8f</id>
<content type='text'>
- [x] Rank keywords just by plain usages
- [x] `LocalSyntaxAnalysis` now returns a mapping `:: Keyword -&gt; [Following Keywords]`.
- [x] Extracted keyword sequence formatting from `syntax/local` to `syntax/format`.
- [x] Extracted token display logic from `syntax/local` to `antlr4/vocabulary` as it is ANTLR dependent.

---

Example

```python
$ ./yql_complete &lt;&lt;&lt; "select "
[Keyword] CAST(
[Keyword] NULL
[Keyword] NOT
[FunctionName] If(
[FunctionName] Yson::ConvertToString(
[FunctionName] Count(
[FunctionName] Sum(
[FunctionName] Unwrap(
[FunctionName] Coalesce(
[Keyword] DISTINCT
[Keyword] ALL
[Keyword] CASE
[FunctionName] Max(
[Keyword] FALSE
[FunctionName] Some(
```

---

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

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1197
commit_hash:f42cb4aaffe6de7c9137069c4d9c635ee110a805
</content>
</entry>
<entry>
<title>YQL-19747 Complete read hints on PROCESS and REDUCE</title>
<updated>2025-04-10T14:35:51Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-04-10T14:08:20Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=473f2869597653cf26c8582095d1d9a805cb66fb'/>
<id>urn:sha1:473f2869597653cf26c8582095d1d9a805cb66fb</id>
<content type='text'>
Forgot to support it.

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

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1195
commit_hash:a2f5937dbca5712f3ecbfccdf66662ce99e70619
</content>
</entry>
<entry>
<title>YQL-19747 Introduce types and functions ranking</title>
<updated>2025-04-02T12:53:10Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-04-02T12:37:42Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=9728f9489a1c25e2b2e1e7959fa662a389f68db8'/>
<id>urn:sha1:9728f9489a1c25e2b2e1e7959fa662a389f68db8</id>
<content type='text'>
- [x] Fix bug with incorrect no-case sorting.
- [x] Get names from `sql_functions.json` and `types.json`.
- [x] Add types and functions ranking according to `rules_corr_basic.json` data via a `PartialSort`.
- [x] Add benchmark workspace.

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1167
commit_hash:84d93265fb69bf5651f905d6af038056657e9a16
</content>
</entry>
<entry>
<title>YQL-19747 Complete Function Names</title>
<updated>2025-03-28T19:36:16Z</updated>
<author>
<name>vityaman</name>
<email>vityaman.dev@yandex.ru</email>
</author>
<published>2025-03-28T19:01:21Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=b60cb8f5ce78ae5f63304a534278e124d31398b0'/>
<id>urn:sha1:b60cb8f5ce78ae5f63304a534278e124d31398b0</id>
<content type='text'>
- Function names are suggested now
- Changed the module structure
- Checking ruleIndex independence on mode (ansi | default) via unit tests

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1163
commit_hash:1b1a27d2cff8db663c5c7e8efb57896476823315
</content>
</entry>
</feed>
