7
7
#include < yql/essentials/sql/v1/complete/sql_complete.h>
8
8
#include < yql/essentials/sql/v1/complete/name/cache/local/cache.h>
9
9
#include < yql/essentials/sql/v1/complete/name/object/simple/cached/schema.h>
10
+ #include < yql/essentials/sql/v1/complete/name/service/impatient/name_service.h>
10
11
#include < yql/essentials/sql/v1/complete/name/service/schema/name_service.h>
11
12
#include < yql/essentials/sql/v1/complete/name/service/static/name_service.h>
12
13
#include < yql/essentials/sql/v1/complete/name/service/union/name_service.h>
@@ -116,6 +117,7 @@ namespace NYdb::NConsoleClient {
116
117
case NSQLComplete::ECandidateKind::TableName:
117
118
return Color.identifier .quoted ;
118
119
case NSQLComplete::ECandidateKind::BindingName:
120
+ case NSQLComplete::ECandidateKind::ColumnName:
119
121
return Color.identifier .variable ;
120
122
default :
121
123
return replxx::Replxx::Color::DEFAULT;
@@ -138,16 +140,22 @@ namespace NYdb::NConsoleClient {
138
140
};
139
141
}
140
142
141
- NSQLComplete::ISchemaListCache::TPtr MakeSchemaCache () {
143
+ NSQLComplete::TSchemaCaches MakeSchemaCaches () {
142
144
using TKey = NSQLComplete::TSchemaDescribeCacheKey;
143
- using TValue = TVector<NSQLComplete::TFolderEntry>;
144
145
145
- return NSQLComplete::MakeLocalCache<TKey, TValue>(
146
- NMonotonic::CreateDefaultMonotonicTimeProvider (),
147
- {
148
- .ByteCapacity = 1 * 1024 * 1024 ,
149
- .TTL = TDuration::Seconds (8 ),
150
- });
146
+ auto time = NMonotonic::CreateDefaultMonotonicTimeProvider ();
147
+
148
+ NSQLComplete::TLocalCacheConfig config = {
149
+ .ByteCapacity = 1 * 1024 * 1024 ,
150
+ .TTL = TDuration::Seconds (8 ),
151
+ };
152
+
153
+ return {
154
+ .List = NSQLComplete::MakeLocalCache<
155
+ TKey, TVector<NSQLComplete::TFolderEntry>>(time, config),
156
+ .DescribeTable = NSQLComplete::MakeLocalCache<
157
+ TKey, TMaybe<NSQLComplete::TTableDetails>>(time, config),
158
+ };
151
159
}
152
160
153
161
IYQLCompleter::TPtr MakeYQLCompleter (
@@ -156,25 +164,33 @@ namespace NYdb::NConsoleClient {
156
164
157
165
auto ranking = NSQLComplete::MakeDefaultRanking (NSQLComplete::LoadFrequencyData ());
158
166
159
- TVector<NSQLComplete::INameService::TPtr> services = {
160
- NSQLComplete::MakeStaticNameService (
161
- NSQLComplete::LoadDefaultNameSet (), ranking),
167
+ auto statics = NSQLComplete::MakeStaticNameService (NSQLComplete::LoadDefaultNameSet (), ranking);
162
168
169
+ auto schema =
163
170
NSQLComplete::MakeSchemaNameService (
164
171
NSQLComplete::MakeSimpleSchema (
165
172
NSQLComplete::MakeCachedSimpleSchema (
166
- MakeSchemaCache (),
173
+ MakeSchemaCaches (),
167
174
/* zone = */ "",
168
- MakeYDBSchema(std::move(driver), std::move(database), isVerbose)))),
169
- };
175
+ MakeYDBSchema(std::move(driver), std::move(database), isVerbose))));
176
+
177
+ auto heavy = NSQLComplete::MakeUnionNameService(
178
+ {
179
+ statics,
180
+ schema,
181
+ }, ranking);
170
182
171
- auto service = NSQLComplete::MakeUnionNameService(std::move(services), std::move(ranking));
183
+ auto light = NSQLComplete::MakeUnionNameService(
184
+ {
185
+ statics,
186
+ NSQLComplete::MakeImpatientNameService (schema),
187
+ }, ranking);
172
188
173
189
auto config = NSQLComplete::MakeYDBConfiguration ();
174
190
175
191
return IYQLCompleter::TPtr (new TYQLCompleter (
176
- /* heavyEngine = */ NSQLComplete::MakeSqlCompletionEngine(lexer, service , config),
177
- /* lightEngine = */ NSQLComplete::MakeSqlCompletionEngine(lexer, service , config),
192
+ /* heavyEngine = */ NSQLComplete::MakeSqlCompletionEngine (lexer, heavy , config),
193
+ /* lightEngine = */ NSQLComplete::MakeSqlCompletionEngine (lexer, light , config),
178
194
std::move (color)));
179
195
}
180
196
0 commit comments