summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/complete/sql_complete.cpp
Commit message (Collapse)AuthorAgeFilesLines
* YQL-20301: Map unsupported object to UnknownNamevitya-smirnov2025-08-131-5/+3
| | | | | | | Before this PR unsupported objects were filtered, but we would like to show even unsupported object types as unknown name candidates. commit_hash:04c64b6e28717c3c19927d49eeedec7515608c22
* YQL-19747: Improve and fix completon enginevitya-smirnov2025-08-121-1/+14
| | | | | | | | | | | | | | Played with the autocomplete and found some issues: https://nda.ya.ru/t/1F9ioYe37HVwo2. - Supported `min`, `max` parameters of the `RANGE` table function, respecting `prefix`. - Supported cluster detecton at table function, e.g. `SELECT * FROM plato.RANGE(Input1, Input2)`. - Made column filter not to ignore a table alias. - Supported keyword as identifier parsing. - Supported `ID_QUOTED` as table alias. commit_hash:9e9ff13373cd059e6a240ddff0ae18f599d790c0
* YQL-20221: Change FilterText for bindingvitya-smirnov2025-07-221-2/+0
| | | | | The last fix of the Monaco Editor named expr filtration. commit_hash:542d6b9f549f8037057fccf5a898ec1f74718748
* YQL-20221: Change binding replace rangevitya-smirnov2025-07-221-3/+3
| | | | | | | | | | Symbol `$` was excluded from the `BindingName` candidate content as `Replxx` interprets `$` as a word break. The problem is that Monaco Editor accounts `$` as a word part and filters out bindings. This patch makes `$` a word part and adds replace range to handle this properly at `Replxx`. commit_hash:ca3959635a6c0e6688bcbe7622a9c2aab6c683eb
* YQL-19747: Complete table functionsvitya-smirnov2025-07-101-8/+28
| | | | | | | | | | | | - Added table functions completion. - Also fixed a bug when USEd cluster was not added to table context at table function argument. - Complete folder names at `prefix` of `LIKE`, `RANGE`, etc. commit_hash:26be383be728796e8431f906e2815acd77645ad4
* YQL-19747: Fix binding precence at ID_QUOTEDvitya-smirnov2025-07-091-1/+3
| | | | commit_hash:a497dfe8863a864913c1d6df4b28edbe7d8e4bba
* YQL-19747: Fix FilterText for a named expressionvitya-smirnov2025-07-081-0/+2
| | | | | | Related to <https://nda.ya.ru/t/DMAUQona7GBKMA>. There was a problem with a binding ranking. commit_hash:6dbd96ec883562c4e03778a8487b2843be189ce7
* YQL-19747: Fix small TODOsvitya-smirnov2025-07-041-33/+32
| | | | | | | | | | | | | - YQL-19747: Remove unused header - YQL-19747: Remove NameSet alias - YQL-19747: Fix identifier typo - YQL-19747: Cosmetics - YQL-19747: Receive NameRequest as const ref - YQL-19747: Remove string_util.h - YQL-19747: Change engine.Complete - YQL-19747: Remove configuration typedef - YQL-19747: Rename context to local commit_hash:451a6ba7c08e670a492222a29463be40a627c867
* YQL-19747: Support LSP FilterTextvitya-smirnov2025-07-031-0/+8
| | | | | | | | | | | | | | | | | | | LSP protocol has a property ``` /** * A string that should be used when filtering a set of * completion items. When omitted the label is used as the * filter text for this item. */ filterText?: string; ``` It is useful, e.g. when we prepend some punctuation at a candidate content, but still want to filter by prefix, ignoring that punctuation. Related to https://nda.ya.ru/t/KCkzjhXS7G3Epg. commit_hash:01f258218d312eef764350bd4d78da15acb8c9ea
* YQL-19747: Respect WITHOUT at schema synthesisvitya-smirnov2025-07-031-0/+1
| | | | | | | | | Also fixed a bug when the same table used with and without an alias produced duplicated column names. This is incorrect at translator, but anyway we need to handle it gracefully. Also refactored some utility methods like context union. commit_hash:45a12675e865bb9d929e5e5178e16239a763d1f5
* YQL-19747: Refactor SQL completion enginevitya-smirnov2025-06-261-195/+9
| | | | | | | | | | | Some refactorings to compact the code: - YQL-19747: Pass TParsedInput to visitor - YQL-19747: Add TParsedInput - YQL-19747: Cosmetics - YQL-19747: Refactor configuration - YQL-19747: Refactor name to candidate mapping commit_hash:44dfe7dc7bcc627ef9c20696077f2d962a3014f6
* YQL-19747: Support qualified asteriskvitya-smirnov2025-06-251-1/+5
| | | | | Support `SELECT x.* FROM t AS x`. commit_hash:64693f65281f385d6c0d3541fb2874b0153aa88c
* YQL-19747: Fix self-join completionvitya-smirnov2025-06-251-30/+8
| | | | | | | | Fixed a bug on self-join, as table path was used as a key to match columns with tables instead of an alias. commit_hash:0f9735a4c5ba0b2b88efc764bc5e7f5d41633fd8
* YQL-19747: Synthesise subquery columnsvitya-smirnov2025-06-241-1/+14
| | | | commit_hash:40a2de243a67135e44505619fb766954ba24e2e8
* YQL-19747: Set cursor shift at completion itemvitya-smirnov2025-06-231-10/+52
| | | | | | | | Set `TCandidate::Shift` for functions and generic types. So now brackets are balanced and UI should adopt it. YDB CLI is ready for the update and just cut off symbols after an expected cursor position. commit_hash:9efc1110869af7be618b841c6c132572b61046a1
* YQL-19747: Auto-close backtick on not foldervitya-smirnov2025-06-191-2/+5
| | | | | | | | When table `folder/table` exists. On prefix ``` SELECT * FROM `folder/ ``` users want to accept ``` table` ``` rather than just `table`. This patch is about it. commit_hash:12d36cbf037db91f49136ab8e013b160a28b5b1b
* YQL-19747: Support table aliasesvitya-smirnov2025-06-181-7/+31
| | | | commit_hash:6d67ec1fa5023083debd89aaa99950019ca37c90
* YQL-20086 sqlvvvv2025-06-181-7/+7
| | | | commit_hash:b06f3d2f5fa81e2073966eb172758758bd94fdf2
* YQL-19747: Support token ignoring patternsvitya-smirnov2025-06-171-8/+24
| | | | | Added support for token filtration. It is needed because YQL grammar supports multiple systems with various capabilities. For example, some of those do not support `INTERSECT ALL` and therefore `ALL` after `INTERSECT` should be *disabled*. Another example is a support of an only `EVALUATE FOR`, so `FOR` is *forced* to be precendenced by `EVALUATE`. commit_hash:a926c8d3911f8dd025ab58eb7f81e2370fcd9376
* YQL-19747: Complete columns at simple selectvitya-smirnov2025-06-171-0/+12
| | | | | Added support for a columns completion at a simple select. For example, `` SELECT # FROM hahn.`home/yql/tutorial/users` `` и `` USE hahn; SELECT $ FROM `home/yql/tutorial/users` ``. commit_hash:2254449e91255c19792a1dc521825e44dda7d63b
* YQL-19747: Improve types completionvitya-smirnov2025-06-171-0/+10
| | | | | Instead of relying on keyword sequences provided by C3 and using hacks like pattern matching on keyword sequences (`format.cpp`), emit composite types manually. commit_hash:999d8d4b514433fbdf7885aa0122b2010e985efb
* YQL-19747: Support table completion at CONCATvityaman2025-06-111-3/+11
| | | | | | | | | | | | --- - Related to `YQL-19747` - Related to https://github.com/vityaman/ydb/issues/62 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1323 commit_hash:ebab6c3290ba984174c85bba35eeb066b53af5aa
* YQL-19747: Extract analysis/localvityaman2025-06-091-1/+1
| | | | | | | | | | | - Related to `YQL-19747` - Related to https://github.com/ydb-platform/ydb/issues/9056 - Related to https://github.com/vityaman/ydb/issues/52 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1321 commit_hash:ef8af2fa618e6fc316d7a6cf348b7f737bb0cfb4
* YQL-19747: Fix some TODOs and Clang Tidy checksvityaman2025-06-061-8/+9
| | | | | | | | | | | | | | | | | | | Clang Tidy is cool, but too slow ;(. Btw, should we respect `misc-include-cleaner` check? ```bash ya dump compile-commands > /tmp/cc/compile_commands.json find . -type f \( -name "*.cpp" -o -name "*.h" \) -exec clang-tidy {} -p /tmp/cc {} -checks="misc-*" \; ``` --- - Related to `YQL-19747` - Related to https://github.com/ydb-platform/ydb/issues/9056 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1305 commit_hash:c2ecf638062dcdd0730fed3381da4a230f5352c3
* YQL-19747: Ignore unsupported statements for YDBvityaman2025-06-021-1/+5
| | | | | | | | | | | - Related to `YQL-19747` - Related to https://github.com/ydb-platform/ydb/issues/9056 - Related to https://github.com/vityaman/ydb/issues/39 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1307 commit_hash:782732c290cf2894ec466d2fbb5d0e96905f1804
* YQL-19747: Complete named expressionsvityaman2025-06-021-1/+21
| | | | | | | | | | | | | | | | | | | - 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
* YQL-19747: Support cursor shifting on completionvityaman2025-05-281-2/+2
| | | | | | | | | | | | | | | | | 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 <[email protected]> commit_hash:38bcd21f0d6959275af89a981fd9b296374aea51
* YQL-19747: Fix cluster provider interpretationvityaman2025-05-271-1/+1
| | | | | | | | | | | | | | | There was a mistake thinking that provider is a part of a cluster name. Actually `yt:saurus` and `saurus` are same clusters and provider (`yt`) serves only as a hint for translation expressions such as `yt:$cluster_name`. --- - Related to `YQL-19747` - Related to https://github.com/vityaman/ydb/issues/54 - Related to https://github.com/ydb-platform/ydb/issues/9056 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1301 commit_hash:19a45cf0bb6c7dda26747b2e3371646272f79bce
* YQL-19747: Support immediate string named expressionsvityaman2025-05-271-3/+3
| | | | | | | | | | | --- - 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
* YQL-19747: Refactor ISqlCompletionEngine configurationvityaman2025-05-261-13/+17
| | | | | | | | | | | | | | | | | > no such statement > sql_stmt: (EXPLAIN (QUERY PLAN)?)? sql_stmt_core; > I suggest to add it always if needed for c3 --- - Related to `YQL-19747` - Related to https://github.com/ytsaurus/ytsaurus/pull/1289 - Related to https://github.com/vityaman/ydb/issues/39 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1297 commit_hash:7b1a8947fdd5d8c6b737e781f2288632359f569d
* YQL-19747: Support statement blacklistvityaman2025-05-231-1/+37
| | | | | | | | | | | | | | 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
* YQL-19747: Support USE statementvityaman2025-05-201-7/+22
| | | | | | | | | | | | | | Introduce global analysis which will be extended with more ParseTree analysis later. --- - Related to `YQL-19747` - Related to https://github.com/vityaman/ydb/issues/40 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1281 commit_hash:848fb3fdd6bc9612769c47d66198fca018ff465f
* YQL-19747: Fix unquoted object path completionvityaman2025-05-191-2/+2
| | | | | | | | | | | | | | | | 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
* YQL-19747 Complete folder, table and cluster namesvityaman2025-05-061-51/+127
| | | | | | | | | | | | | | | | --- - 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
* YQL-19747: Refactor sql/v1/complete usage of Future and Ptrvityaman2025-04-251-16/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - [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 -> LocalSyntaxAnalysis -> 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 <[email protected]> Co-authored-by: vvvv <[email protected]> commit_hash:497cc081ab78bebf7354e0acfaa418d936cc8240
* YQL-19747 Remove default completion engine factoryvityaman2025-04-151-19/+0
| | | | | | | | | | | | | 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
* YQL-19747 Rank keywords just by plain usagesvityaman2025-04-141-40/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - [x] Rank keywords just by plain usages - [x] `LocalSyntaxAnalysis` now returns a mapping `:: Keyword -> [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 <<< "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
* YQL-19747 Complete select and insert hintsvityaman2025-04-091-0/+12
| | | | | | | | | | - 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
* YQL-19747 Complete after PRAGMA and multi-token namesvityaman2025-04-081-6/+20
| | | | | | | | | | | | - [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
* YQL-19747 Improve yql_complete tool and add input validationvityaman2025-04-081-0/+9
| | | | | | | | | No description --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1185 commit_hash:1def5874ff6a9a5b3dcdd0ad285d2e64b16c9306
* YQL-19747 Complete token sequencesvityaman2025-04-021-0/+1
| | | | | | | | | | | | | Token sequences plan - [x] [Easy] Support `GROUP BY`, `ORDER BY`. - [x] [Easy] Support `Optional<`, `List<`, `Dict<`. - [x] [Easy] Support `Avg(`, `Sum(`. --- Co-authored-by: Victor Smirnov [[email protected]] Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1173 commit_hash:a443dec666c486fef7f891be04d68a786be83049
* YQL-19747 Introduce types and functions rankingvityaman2025-04-021-2/+2
| | | | | | | | | | | | - [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
* YQL-19747 Complete Function Namesvityaman2025-03-281-11/+19
| | | | | | | | | | | - 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
* YQL-19616 Convert YQL lexer grammar to regexesvityaman2025-03-281-1/+3
| | | | | | | | | | | | | | | | | - [x] Parse YQL grammar to extract lexer grammar into `TLexerGrammar`. - [x] Translate `TLexerGrammar` into regexes. - [x] Implement a lexer via regexes `TRegexLexer` to test generated regexes validity. - [x] Test on `Default` syntax mode. - [x] Test on `ANSI` syntax mode. --- - Related to https://github.com/ydb-platform/ydb/issues/15129 - Requirement for https://github.com/ytsaurus/ytsaurus/pull/1112 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1127 commit_hash:03ffffe81cdafe7f93a4d3fd9a3212fe67f1c72d
* YQL-19747 Complete a simple type namevityaman2025-03-281-18/+72
| | | | | | | | | - Related to https://github.com/ydb-platform/ydb/issues/9056 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1151 commit_hash:6e1e429a2ea805016bf00a1e60b501b7fc8dc8de
* YQL-19747 Split statementsvityaman2025-03-271-3/+17
| | | | | | | | | | | | When we run completion engine on multi-statement query, where preceding statements are syntactically incorrect, `antlr4-c3` does not return candidates. Running engine only on a current statement provides a best-effort attempt to provide candidates. - Related to https://github.com/ydb-platform/ydb/issues/9056 - Depends on https://github.com/ytsaurus/ytsaurus/pull/1127 (`ELexerFlavor`) --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1144 commit_hash:0ced9443a9712191f5420246531f781ca4bc5f42
* Intermediate changesrobot-piglet2025-02-281-0/+89
commit_hash:5fc851d2c72810067fe0d407b66535b17de63129