@@ -72,6 +72,78 @@ static void FillTableStats(NKikimrSchemeOp::TPathDescription& pathDescription, c
72
72
FillTableMetrics (pathDescription.MutableTabletMetrics (), stats);
73
73
}
74
74
75
+ static void FillColumns (
76
+ const TTableInfo& tableInfo,
77
+ google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TColumnDescription>& out
78
+ ) {
79
+ bool familyNamesBuilt = false ;
80
+ THashMap<ui32, TString> familyNames;
81
+
82
+ out.Reserve (tableInfo.Columns .size ());
83
+ for (const auto & col : tableInfo.Columns ) {
84
+ const auto & cinfo = col.second ;
85
+ if (cinfo.IsDropped ())
86
+ continue ;
87
+
88
+ auto * colDescr = out.Add ();
89
+ colDescr->SetName (cinfo.Name );
90
+ colDescr->SetType (NScheme::TypeName (cinfo.PType , cinfo.PTypeMod ));
91
+ auto columnType = NScheme::ProtoColumnTypeFromTypeInfoMod (cinfo.PType , cinfo.PTypeMod );
92
+ colDescr->SetTypeId (columnType.TypeId );
93
+ if (columnType.TypeInfo ) {
94
+ *colDescr->MutableTypeInfo () = *columnType.TypeInfo ;
95
+ }
96
+ colDescr->SetId (cinfo.Id );
97
+ colDescr->SetNotNull (cinfo.NotNull );
98
+
99
+ if (cinfo.Family != 0 ) {
100
+ colDescr->SetFamily (cinfo.Family );
101
+
102
+ if (!familyNamesBuilt) {
103
+ for (const auto & family : tableInfo.PartitionConfig ().GetColumnFamilies ()) {
104
+ if (family.HasName () && family.HasId ()) {
105
+ familyNames[family.GetId ()] = family.GetName ();
106
+ }
107
+ }
108
+ familyNamesBuilt = true ;
109
+ }
110
+
111
+ auto it = familyNames.find (cinfo.Family );
112
+ if (it != familyNames.end () && !it->second .empty ()) {
113
+ colDescr->SetFamilyName (it->second );
114
+ }
115
+ }
116
+
117
+ colDescr->SetIsBuildInProgress (cinfo.IsBuildInProgress );
118
+
119
+ switch (cinfo.DefaultKind ) {
120
+ case ETableColumnDefaultKind::None:
121
+ break ;
122
+ case ETableColumnDefaultKind::FromSequence:
123
+ colDescr->SetDefaultFromSequence (cinfo.DefaultValue );
124
+ break ;
125
+ case ETableColumnDefaultKind::FromLiteral:
126
+ Y_ABORT_UNLESS (colDescr->MutableDefaultFromLiteral ()->ParseFromString (
127
+ cinfo.DefaultValue ));
128
+ break ;
129
+ }
130
+ }
131
+ }
132
+
133
+ static void FillKeyColumns (
134
+ const TTableInfo& tableInfo,
135
+ google::protobuf::RepeatedPtrField<TProtoStringType>& names,
136
+ google::protobuf::RepeatedField<ui32>& ids
137
+ ) {
138
+ Y_ABORT_UNLESS (!tableInfo.KeyColumnIds .empty ());
139
+ names.Reserve (tableInfo.KeyColumnIds .size ());
140
+ ids.Reserve (tableInfo.KeyColumnIds .size ());
141
+ for (ui32 keyColId : tableInfo.KeyColumnIds ) {
142
+ *names.Add () = tableInfo.Columns .at (keyColId).Name ;
143
+ *ids.Add () = keyColId;
144
+ }
145
+ }
146
+
75
147
void TPathDescriber::FillPathDescr (NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl, TPathElement::EPathSubType subType) {
76
148
FillChildDescr (descr, pathEl);
77
149
@@ -292,6 +364,7 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
292
364
bool returnBoundaries = false ;
293
365
bool returnRangeKey = true ;
294
366
bool returnSetVal = Params.GetOptions ().GetReturnSetVal ();
367
+ bool returnIndexTableBoundaries = Params.GetOptions ().GetReturnIndexTableBoundaries ();
295
368
if (Params.HasOptions ()) {
296
369
returnConfig = Params.GetOptions ().GetReturnPartitionConfig ();
297
370
returnPartitioning = Params.GetOptions ().GetReturnPartitioningInfo ();
@@ -416,7 +489,9 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
416
489
417
490
switch (childPath->PathType ) {
418
491
case NKikimrSchemeOp::EPathTypeTableIndex:
419
- Self->DescribeTableIndex (childPathId, childName, returnConfig, false , *entry->AddTableIndexes ());
492
+ Self->DescribeTableIndex (
493
+ childPathId, childName, returnConfig, returnIndexTableBoundaries, *entry->AddTableIndexes ()
494
+ );
420
495
break ;
421
496
case NKikimrSchemeOp::EPathTypeCdcStream:
422
497
Self->DescribeCdcStream (childPathId, childName, *entry->AddCdcStreams ());
@@ -1175,67 +1250,10 @@ void TSchemeShard::DescribeTable(
1175
1250
) const
1176
1251
{
1177
1252
Y_UNUSED (typeRegistry);
1178
- THashMap<ui32, TString> familyNames;
1179
- bool familyNamesBuilt = false ;
1180
1253
1181
1254
entry->SetTableSchemaVersion (tableInfo->AlterVersion );
1182
- entry->MutableColumns ()->Reserve (tableInfo->Columns .size ());
1183
- for (auto col : tableInfo->Columns ) {
1184
- const auto & cinfo = col.second ;
1185
- if (cinfo.IsDropped ())
1186
- continue ;
1187
-
1188
- auto colDescr = entry->AddColumns ();
1189
- colDescr->SetName (cinfo.Name );
1190
- colDescr->SetType (NScheme::TypeName (cinfo.PType , cinfo.PTypeMod ));
1191
- auto columnType = NScheme::ProtoColumnTypeFromTypeInfoMod (cinfo.PType , cinfo.PTypeMod );
1192
- colDescr->SetTypeId (columnType.TypeId );
1193
- if (columnType.TypeInfo ) {
1194
- *colDescr->MutableTypeInfo () = *columnType.TypeInfo ;
1195
- }
1196
- colDescr->SetId (cinfo.Id );
1197
- colDescr->SetNotNull (cinfo.NotNull );
1198
-
1199
- if (cinfo.Family != 0 ) {
1200
- colDescr->SetFamily (cinfo.Family );
1201
-
1202
- if (!familyNamesBuilt) {
1203
- for (const auto & family : tableInfo->PartitionConfig ().GetColumnFamilies ()) {
1204
- if (family.HasName () && family.HasId ()) {
1205
- familyNames[family.GetId ()] = family.GetName ();
1206
- }
1207
- }
1208
- familyNamesBuilt = true ;
1209
- }
1210
-
1211
- auto it = familyNames.find (cinfo.Family );
1212
- if (it != familyNames.end () && !it->second .empty ()) {
1213
- colDescr->SetFamilyName (it->second );
1214
- }
1215
- }
1216
-
1217
- colDescr->SetIsBuildInProgress (cinfo.IsBuildInProgress );
1218
-
1219
- switch (cinfo.DefaultKind ) {
1220
- case ETableColumnDefaultKind::None:
1221
- break ;
1222
- case ETableColumnDefaultKind::FromSequence:
1223
- colDescr->SetDefaultFromSequence (cinfo.DefaultValue );
1224
- break ;
1225
- case ETableColumnDefaultKind::FromLiteral:
1226
- Y_ABORT_UNLESS (colDescr->MutableDefaultFromLiteral ()->ParseFromString (
1227
- cinfo.DefaultValue ));
1228
- break ;
1229
- }
1230
- }
1231
- Y_ABORT_UNLESS (!tableInfo->KeyColumnIds .empty ());
1232
-
1233
- entry->MutableKeyColumnNames ()->Reserve (tableInfo->KeyColumnIds .size ());
1234
- entry->MutableKeyColumnIds ()->Reserve (tableInfo->KeyColumnIds .size ());
1235
- for (ui32 keyColId : tableInfo->KeyColumnIds ) {
1236
- entry->AddKeyColumnNames (tableInfo->Columns [keyColId].Name );
1237
- entry->AddKeyColumnIds (keyColId);
1238
- }
1255
+ FillColumns (*tableInfo, *entry->MutableColumns ());
1256
+ FillKeyColumns (*tableInfo, *entry->MutableKeyColumnNames (), *entry->MutableKeyColumnIds ());
1239
1257
1240
1258
if (fillConfig) {
1241
1259
FillPartitionConfig (tableInfo->PartitionConfig (), *entry->MutablePartitionConfig ());
@@ -1299,6 +1317,9 @@ void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name
1299
1317
FillPartitionConfig (tableInfo->PartitionConfig (), *tableDescription->MutablePartitionConfig ());
1300
1318
}
1301
1319
if (fillBoundaries) {
1320
+ // column info is necessary for split boundary type conversion
1321
+ FillColumns (*tableInfo, *tableDescription->MutableColumns ());
1322
+ FillKeyColumns (*tableInfo, *tableDescription->MutableKeyColumnNames (), *tableDescription->MutableKeyColumnIds ());
1302
1323
FillTableBoundaries (tableDescription->MutableSplitBoundary (), tableInfo);
1303
1324
}
1304
1325
}
0 commit comments