Skip to content

Commit 02d2031

Browse files
authored
more information about columns in autocomplete handler (#11470)
1 parent 7b9c7e3 commit 02d2031

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

ydb/core/viewer/protos/viewer.proto

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,26 @@ enum EAutocompleteType {
762762
}
763763

764764
message TQueryAutocomplete {
765+
enum EDefaultKind {
766+
None = 0;
767+
Sequence = 1;
768+
Literal = 2;
769+
Reserved3 = 3;
770+
Reserved4 = 4;
771+
Reserved5 = 5;
772+
Reserved6 = 6;
773+
Reserved7 = 7;
774+
Reserved8 = 8;
775+
Reserved9 = 9;
776+
}
765777
message TResult {
766778
message TEntity {
767779
string Name = 1;
768780
EAutocompleteType Type = 2;
769781
string Parent = 3;
782+
optional uint32 PKIndex = 4;
783+
optional bool NotNull = 5;
784+
EDefaultKind Default = 6;
770785
}
771786
optional uint32 Total = 1;
772787
repeated TEntity Entities = 2;

ydb/core/viewer/viewer_autocomplete.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class TJsonAutocomplete : public TViewerPipeClient {
2626
TString Name;
2727
NKikimrViewer::EAutocompleteType Type;
2828
TString Parent;
29+
std::optional<ui32> PKIndex;
30+
bool NotNull = false;
31+
TSysTables::TTableColumnInfo::EDefaultKind Default = TSysTables::TTableColumnInfo::EDefaultKind::DEFAULT_UNDEFINED;
2932

3033
TSchemaWordData(const TString& name, const NKikimrViewer::EAutocompleteType type, const TString& parent = {})
3134
: Name(name)
@@ -241,7 +244,16 @@ class TJsonAutocomplete : public TViewerPipeClient {
241244
}
242245
TString path = JoinPath(entry.Path);
243246
for (const auto& [id, column] : entry.Columns) {
244-
Dictionary.emplace_back(column.Name, NKikimrViewer::column, path);
247+
auto& dicColumn = Dictionary.emplace_back(column.Name, NKikimrViewer::column, path);
248+
if (column.KeyOrder >= 0) {
249+
dicColumn.PKIndex = column.KeyOrder;
250+
}
251+
if (column.IsNotNullColumn) {
252+
dicColumn.NotNull = true;
253+
}
254+
if (column.DefaultKind != TSysTables::TTableColumnInfo::DEFAULT_UNDEFINED) {
255+
dicColumn.Default = column.DefaultKind;
256+
}
245257
}
246258
for (const auto& index : entry.Indexes) {
247259
Dictionary.emplace_back(index.GetName(), NKikimrViewer::index, path);
@@ -302,6 +314,15 @@ class TJsonAutocomplete : public TViewerPipeClient {
302314
if (wordData->Parent) {
303315
entity->SetParent(wordData->Parent);
304316
}
317+
if (wordData->PKIndex) {
318+
entity->SetPKIndex(*wordData->PKIndex);
319+
}
320+
if (wordData->NotNull) {
321+
entity->SetNotNull(wordData->NotNull);
322+
}
323+
if (wordData->Default != TSysTables::TTableColumnInfo::DEFAULT_UNDEFINED) {
324+
entity->SetDefault(static_cast<NKikimrViewer::TQueryAutocomplete_EDefaultKind>(wordData->Default));
325+
}
305326
}
306327
}
307328

0 commit comments

Comments
 (0)