@@ -73,6 +73,79 @@ static void FillTableStats(NKikimrSchemeOp::TPathDescription& pathDescription, c
73
73
FillTableMetrics (pathDescription.MutableTabletMetrics (), stats);
74
74
}
75
75
76
+ static void FillColumns (
77
+ const TTableInfo& tableInfo,
78
+ google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TColumnDescription>& out
79
+ ) {
80
+ bool familyNamesBuilt = false ;
81
+ THashMap<ui32, TString> familyNames;
82
+
83
+ out.Reserve (tableInfo.Columns .size ());
84
+ for (const auto & col : tableInfo.Columns ) {
85
+ const auto & cinfo = col.second ;
86
+ if (cinfo.IsDropped ())
87
+ continue ;
88
+
89
+ auto * colDescr = out.Add ();
90
+ colDescr->SetName (cinfo.Name );
91
+ colDescr->SetType (NScheme::TypeName (cinfo.PType , cinfo.PTypeMod ));
92
+ auto columnType = NScheme::ProtoColumnTypeFromTypeInfoMod (cinfo.PType , cinfo.PTypeMod );
93
+ colDescr->SetTypeId (columnType.TypeId );
94
+ if (columnType.TypeInfo ) {
95
+ *colDescr->MutableTypeInfo () = *columnType.TypeInfo ;
96
+ }
97
+ colDescr->SetId (cinfo.Id );
98
+ colDescr->SetNotNull (cinfo.NotNull );
99
+
100
+ if (cinfo.Family != 0 ) {
101
+ colDescr->SetFamily (cinfo.Family );
102
+
103
+ if (!familyNamesBuilt) {
104
+ for (const auto & family : tableInfo.PartitionConfig ().GetColumnFamilies ()) {
105
+ if (family.HasName () && family.HasId ()) {
106
+ familyNames[family.GetId ()] = family.GetName ();
107
+ }
108
+ }
109
+ familyNamesBuilt = true ;
110
+ }
111
+
112
+ auto it = familyNames.find (cinfo.Family );
113
+ if (it != familyNames.end () && !it->second .empty ()) {
114
+ colDescr->SetFamilyName (it->second );
115
+ }
116
+ }
117
+
118
+ colDescr->SetIsBuildInProgress (cinfo.IsBuildInProgress );
119
+
120
+ switch (cinfo.DefaultKind ) {
121
+ case ETableColumnDefaultKind::None:
122
+ break ;
123
+ case ETableColumnDefaultKind::FromSequence:
124
+ colDescr->SetDefaultFromSequence (cinfo.DefaultValue );
125
+ break ;
126
+ case ETableColumnDefaultKind::FromLiteral:
127
+ Y_ABORT_UNLESS (colDescr->MutableDefaultFromLiteral ()->ParseFromString (
128
+ cinfo.DefaultValue ));
129
+ break ;
130
+ }
131
+ }
132
+ }
133
+
134
+ static void FillKeyColumns (
135
+ const TTableInfo& tableInfo,
136
+ google::protobuf::RepeatedPtrField<TProtoStringType>& names,
137
+ google::protobuf::RepeatedField<ui32>& ids
138
+ ) {
139
+ Y_ABORT_UNLESS (!tableInfo.KeyColumnIds .empty ());
140
+ names.Reserve (tableInfo.KeyColumnIds .size ());
141
+ ids.Reserve (tableInfo.KeyColumnIds .size ());
142
+ for (ui32 keyColId : tableInfo.KeyColumnIds ) {
143
+ *names.Add () = tableInfo.Columns .at (keyColId).Name ;
144
+ *ids.Add () = keyColId;
145
+ }
146
+
147
+ }
148
+
76
149
void TPathDescriber::FillPathDescr (NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl, TPathElement::EPathSubType subType) {
77
150
FillChildDescr (descr, pathEl);
78
151
@@ -303,6 +376,7 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
303
376
bool returnBoundaries = false ;
304
377
bool returnRangeKey = true ;
305
378
bool returnSetVal = Params.GetOptions ().GetReturnSetVal ();
379
+ bool returnIndexTableBoundaries = Params.GetOptions ().GetReturnIndexTableBoundaries ();
306
380
if (Params.HasOptions ()) {
307
381
returnConfig = Params.GetOptions ().GetReturnPartitionConfig ();
308
382
returnPartitioning = Params.GetOptions ().GetReturnPartitioningInfo ();
@@ -427,7 +501,9 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
427
501
428
502
switch (childPath->PathType ) {
429
503
case NKikimrSchemeOp::EPathTypeTableIndex:
430
- Self->DescribeTableIndex (childPathId, childName, returnConfig, false , *entry->AddTableIndexes ());
504
+ Self->DescribeTableIndex (
505
+ childPathId, childName, returnConfig, returnIndexTableBoundaries, *entry->AddTableIndexes ()
506
+ );
431
507
break ;
432
508
case NKikimrSchemeOp::EPathTypeCdcStream:
433
509
Self->DescribeCdcStream (childPathId, childName, *entry->AddCdcStreams ());
@@ -1189,67 +1265,10 @@ void TSchemeShard::DescribeTable(
1189
1265
) const
1190
1266
{
1191
1267
Y_UNUSED (typeRegistry);
1192
- THashMap<ui32, TString> familyNames;
1193
- bool familyNamesBuilt = false ;
1194
1268
1195
1269
entry->SetTableSchemaVersion (tableInfo.AlterVersion );
1196
- entry->MutableColumns ()->Reserve (tableInfo.Columns .size ());
1197
- for (auto col : tableInfo.Columns ) {
1198
- const auto & cinfo = col.second ;
1199
- if (cinfo.IsDropped ())
1200
- continue ;
1201
-
1202
- auto colDescr = entry->AddColumns ();
1203
- colDescr->SetName (cinfo.Name );
1204
- colDescr->SetType (NScheme::TypeName (cinfo.PType , cinfo.PTypeMod ));
1205
- auto columnType = NScheme::ProtoColumnTypeFromTypeInfoMod (cinfo.PType , cinfo.PTypeMod );
1206
- colDescr->SetTypeId (columnType.TypeId );
1207
- if (columnType.TypeInfo ) {
1208
- *colDescr->MutableTypeInfo () = *columnType.TypeInfo ;
1209
- }
1210
- colDescr->SetId (cinfo.Id );
1211
- colDescr->SetNotNull (cinfo.NotNull );
1212
-
1213
- if (cinfo.Family != 0 ) {
1214
- colDescr->SetFamily (cinfo.Family );
1215
-
1216
- if (!familyNamesBuilt) {
1217
- for (const auto & family : tableInfo.PartitionConfig ().GetColumnFamilies ()) {
1218
- if (family.HasName () && family.HasId ()) {
1219
- familyNames[family.GetId ()] = family.GetName ();
1220
- }
1221
- }
1222
- familyNamesBuilt = true ;
1223
- }
1224
-
1225
- auto it = familyNames.find (cinfo.Family );
1226
- if (it != familyNames.end () && !it->second .empty ()) {
1227
- colDescr->SetFamilyName (it->second );
1228
- }
1229
- }
1230
-
1231
- colDescr->SetIsBuildInProgress (cinfo.IsBuildInProgress );
1232
-
1233
- switch (cinfo.DefaultKind ) {
1234
- case ETableColumnDefaultKind::None:
1235
- break ;
1236
- case ETableColumnDefaultKind::FromSequence:
1237
- colDescr->SetDefaultFromSequence (cinfo.DefaultValue );
1238
- break ;
1239
- case ETableColumnDefaultKind::FromLiteral:
1240
- Y_ABORT_UNLESS (colDescr->MutableDefaultFromLiteral ()->ParseFromString (
1241
- cinfo.DefaultValue ));
1242
- break ;
1243
- }
1244
- }
1245
- Y_ABORT_UNLESS (!tableInfo.KeyColumnIds .empty ());
1246
-
1247
- entry->MutableKeyColumnNames ()->Reserve (tableInfo.KeyColumnIds .size ());
1248
- entry->MutableKeyColumnIds ()->Reserve (tableInfo.KeyColumnIds .size ());
1249
- for (ui32 keyColId : tableInfo.KeyColumnIds ) {
1250
- entry->AddKeyColumnNames (tableInfo.Columns .at (keyColId).Name );
1251
- entry->AddKeyColumnIds (keyColId);
1252
- }
1270
+ FillColumns (tableInfo, *entry->MutableColumns ());
1271
+ FillKeyColumns (tableInfo, *entry->MutableKeyColumnNames (), *entry->MutableKeyColumnIds ());
1253
1272
1254
1273
if (fillConfig) {
1255
1274
FillPartitionConfig (tableInfo.PartitionConfig (), *entry->MutablePartitionConfig ());
@@ -1328,6 +1347,9 @@ void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name
1328
1347
FillPartitionConfig (tableInfo.PartitionConfig (), *tableDescription->MutablePartitionConfig ());
1329
1348
}
1330
1349
if (fillBoundaries) {
1350
+ // column info is necessary for split boundary type conversion
1351
+ FillColumns (tableInfo, *tableDescription->MutableColumns ());
1352
+ FillKeyColumns (tableInfo, *tableDescription->MutableKeyColumnNames (), *tableDescription->MutableKeyColumnIds ());
1331
1353
FillTableBoundaries (tableDescription->MutableSplitBoundary (), tableInfo);
1332
1354
}
1333
1355
}
0 commit comments