diff options
author | Alexey Efimov <xeno@ydb.tech> | 2024-11-11 13:49:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-11 12:49:05 +0000 |
commit | 02d2031a62659ea9d85aa481628436a1d0c1480c (patch) | |
tree | aa171cabe30908645e371432246096594029fa9e | |
parent | 7b9c7e3f6223eb40fa69c7415b78f76b94024e24 (diff) | |
download | ydb-02d2031a62659ea9d85aa481628436a1d0c1480c.tar.gz |
more information about columns in autocomplete handler (#11470)
-rw-r--r-- | ydb/core/viewer/protos/viewer.proto | 15 | ||||
-rw-r--r-- | ydb/core/viewer/viewer_autocomplete.h | 23 |
2 files changed, 37 insertions, 1 deletions
diff --git a/ydb/core/viewer/protos/viewer.proto b/ydb/core/viewer/protos/viewer.proto index b2da2cddf0d..12c7b5c5e2b 100644 --- a/ydb/core/viewer/protos/viewer.proto +++ b/ydb/core/viewer/protos/viewer.proto @@ -762,11 +762,26 @@ enum EAutocompleteType { } message TQueryAutocomplete { + enum EDefaultKind { + None = 0; + Sequence = 1; + Literal = 2; + Reserved3 = 3; + Reserved4 = 4; + Reserved5 = 5; + Reserved6 = 6; + Reserved7 = 7; + Reserved8 = 8; + Reserved9 = 9; + } message TResult { message TEntity { string Name = 1; EAutocompleteType Type = 2; string Parent = 3; + optional uint32 PKIndex = 4; + optional bool NotNull = 5; + EDefaultKind Default = 6; } optional uint32 Total = 1; repeated TEntity Entities = 2; diff --git a/ydb/core/viewer/viewer_autocomplete.h b/ydb/core/viewer/viewer_autocomplete.h index 948778c9b36..42ed31ce33c 100644 --- a/ydb/core/viewer/viewer_autocomplete.h +++ b/ydb/core/viewer/viewer_autocomplete.h @@ -26,6 +26,9 @@ class TJsonAutocomplete : public TViewerPipeClient { TString Name; NKikimrViewer::EAutocompleteType Type; TString Parent; + std::optional<ui32> PKIndex; + bool NotNull = false; + TSysTables::TTableColumnInfo::EDefaultKind Default = TSysTables::TTableColumnInfo::EDefaultKind::DEFAULT_UNDEFINED; TSchemaWordData(const TString& name, const NKikimrViewer::EAutocompleteType type, const TString& parent = {}) : Name(name) @@ -241,7 +244,16 @@ public: } TString path = JoinPath(entry.Path); for (const auto& [id, column] : entry.Columns) { - Dictionary.emplace_back(column.Name, NKikimrViewer::column, path); + auto& dicColumn = Dictionary.emplace_back(column.Name, NKikimrViewer::column, path); + if (column.KeyOrder >= 0) { + dicColumn.PKIndex = column.KeyOrder; + } + if (column.IsNotNullColumn) { + dicColumn.NotNull = true; + } + if (column.DefaultKind != TSysTables::TTableColumnInfo::DEFAULT_UNDEFINED) { + dicColumn.Default = column.DefaultKind; + } } for (const auto& index : entry.Indexes) { Dictionary.emplace_back(index.GetName(), NKikimrViewer::index, path); @@ -302,6 +314,15 @@ public: if (wordData->Parent) { entity->SetParent(wordData->Parent); } + if (wordData->PKIndex) { + entity->SetPKIndex(*wordData->PKIndex); + } + if (wordData->NotNull) { + entity->SetNotNull(wordData->NotNull); + } + if (wordData->Default != TSysTables::TTableColumnInfo::DEFAULT_UNDEFINED) { + entity->SetDefault(static_cast<NKikimrViewer::TQueryAutocomplete_EDefaultKind>(wordData->Default)); + } } } |