@@ -94,7 +94,7 @@ struct TSerializerCtx {
94
94
const TIntrusivePtr<NYql::TKikimrTablesData> tablesData,
95
95
const TKikimrConfiguration::TPtr config, ui32 txCount,
96
96
TVector<TVector<NKikimrMiniKQL::TResult>> pureTxResults,
97
- TTypeAnnotationContext& typeCtx,
97
+ TTypeAnnotationContext& typeCtx,
98
98
TIntrusivePtr<NOpt::TKqpOptimizeContext> optCtx)
99
99
: ExprCtx(exprCtx)
100
100
, Cluster(cluster)
@@ -348,7 +348,7 @@ class TxPlanSerializer {
348
348
349
349
writer.WriteKey (" Inputs" );
350
350
writer.BeginList ();
351
-
351
+
352
352
for (const auto & input : op.Inputs ) {
353
353
354
354
if (std::holds_alternative<ui32>(input)) {
@@ -461,6 +461,15 @@ class TxPlanSerializer {
461
461
}
462
462
463
463
void FillConnectionPlanNode (const TDqConnection& connection, TQueryPlanNode& planNode) {
464
+ TDqStageSettings settings = TDqStageSettings::Parse (connection.Output ().Stage ());
465
+ auto GetNarrowColumnName = [&](const TString& wideColumnName) {
466
+ ui32 idx;
467
+ if (!TryFromString (wideColumnName, idx)) {
468
+ return wideColumnName;
469
+ }
470
+ return TString (settings.OutputNarrowType ->GetItems ()[idx]->GetName ());
471
+ };
472
+
464
473
planNode.Type = EPlanNodeType::Connection;
465
474
466
475
if (connection.Maybe <TDqCnUnionAll>()) {
@@ -473,15 +482,23 @@ class TxPlanSerializer {
473
482
planNode.TypeName = " HashShuffle" ;
474
483
auto & keyColumns = planNode.NodeInfo [" KeyColumns" ];
475
484
for (const auto & column : hashShuffle.Cast ().KeyColumns ()) {
476
- keyColumns.AppendValue (TString (column.Value ()));
485
+ if (settings.WideChannels ) {
486
+ keyColumns.AppendValue (GetNarrowColumnName (TString (column.Value ())));
487
+ } else {
488
+ keyColumns.AppendValue (TString (column.Value ()));
489
+ }
477
490
}
478
491
} else if (auto merge = connection.Maybe <TDqCnMerge>()) {
479
492
planNode.TypeName = " Merge" ;
480
493
auto & sortColumns = planNode.NodeInfo [" SortColumns" ];
481
494
for (const auto & sortColumn : merge.Cast ().SortColumns ()) {
482
495
TStringBuilder sortColumnDesc;
483
- sortColumnDesc << sortColumn.Column ().Value () << " ("
484
- << sortColumn.SortDirection ().Value () << " )" ;
496
+ if (settings.WideChannels ) {
497
+ sortColumnDesc << GetNarrowColumnName (TString (sortColumn.Column ().Value ()));
498
+ } else {
499
+ sortColumnDesc << sortColumn.Column ().Value ();
500
+ }
501
+ sortColumnDesc << " (" << sortColumn.SortDirection ().Value () << " )" ;
485
502
486
503
sortColumns.AppendValue (sortColumnDesc);
487
504
}
@@ -1444,7 +1461,7 @@ class TxPlanSerializer {
1444
1461
1445
1462
TOperator op;
1446
1463
op.Properties [" Name" ] = name;
1447
-
1464
+
1448
1465
return AddOperator (planNode, name, std::move (op));
1449
1466
}
1450
1467
@@ -1796,8 +1813,8 @@ class TxPlanSerializer {
1796
1813
1797
1814
template <typename TReadTableSettings>
1798
1815
void AddReadTableSettings (
1799
- TOperator& op,
1800
- const TReadTableSettings& readTableSettings,
1816
+ TOperator& op,
1817
+ const TReadTableSettings& readTableSettings,
1801
1818
TTableRead& readInfo
1802
1819
) {
1803
1820
auto settings = NYql::TKqpReadTableSettings::Parse (readTableSettings);
@@ -1819,9 +1836,9 @@ class TxPlanSerializer {
1819
1836
}
1820
1837
1821
1838
if (settings.SequentialInFlight ) {
1822
- op.Properties [" Scan" ] = " Sequential" ;
1839
+ op.Properties [" Scan" ] = " Sequential" ;
1823
1840
} else {
1824
- op.Properties [" Scan" ] = " Parallel" ;
1841
+ op.Properties [" Scan" ] = " Parallel" ;
1825
1842
}
1826
1843
}
1827
1844
@@ -2021,8 +2038,8 @@ TVector<NJson::TJsonValue> RemoveRedundantNodes(NJson::TJsonValue& plan, const T
2021
2038
return {plan};
2022
2039
}
2023
2040
2024
- NJson::TJsonValue ReconstructQueryPlanRec (const NJson::TJsonValue& plan,
2025
- int operatorIndex,
2041
+ NJson::TJsonValue ReconstructQueryPlanRec (const NJson::TJsonValue& plan,
2042
+ int operatorIndex,
2026
2043
const THashMap<int , NJson::TJsonValue>& planIndex,
2027
2044
const THashMap<TString, NJson::TJsonValue>& precomputes,
2028
2045
int & nodeCounter) {
@@ -2113,14 +2130,14 @@ NJson::TJsonValue ReconstructQueryPlanRec(const NJson::TJsonValue& plan,
2113
2130
NJson::TJsonValue newOps;
2114
2131
NJson::TJsonValue op;
2115
2132
2116
- op[" Name" ] = " TableLookup" ;
2133
+ op[" Name" ] = " TableLookup" ;
2117
2134
op[" Columns" ] = plan.GetMapSafe ().at (" Columns" );
2118
2135
op[" LookupKeyColumns" ] = plan.GetMapSafe ().at (" LookupKeyColumns" );
2119
2136
op[" Table" ] = plan.GetMapSafe ().at (" Table" );
2120
2137
2121
2138
if (plan.GetMapSafe ().contains (" E-Cost" )) {
2122
2139
op[" E-Cost" ] = plan.GetMapSafe ().at (" E-Cost" );
2123
- }
2140
+ }
2124
2141
if (plan.GetMapSafe ().contains (" E-Rows" )) {
2125
2142
op[" E-Rows" ] = plan.GetMapSafe ().at (" E-Rows" );
2126
2143
}
@@ -2195,8 +2212,8 @@ NJson::TJsonValue ReconstructQueryPlanRec(const NJson::TJsonValue& plan,
2195
2212
op.GetMapSafe ().erase (" Inputs" );
2196
2213
}
2197
2214
2198
- if (op.GetMapSafe ().contains (" Input" )
2199
- || op.GetMapSafe ().contains (" ToFlow" )
2215
+ if (op.GetMapSafe ().contains (" Input" )
2216
+ || op.GetMapSafe ().contains (" ToFlow" )
2200
2217
|| op.GetMapSafe ().contains (" Member" )
2201
2218
|| op.GetMapSafe ().contains (" AssumeSorted" )
2202
2219
|| op.GetMapSafe ().contains (" Iterator" )) {
@@ -2269,7 +2286,7 @@ double ComputeCpuTimes(NJson::TJsonValue& plan) {
2269
2286
}
2270
2287
2271
2288
void ComputeTotalRows (NJson::TJsonValue& plan) {
2272
-
2289
+
2273
2290
if (plan.GetMapSafe ().contains (" Plans" )) {
2274
2291
for (auto & p : plan.GetMapSafe ().at (" Plans" ).GetArraySafe ()) {
2275
2292
ComputeTotalRows (p);
@@ -2321,7 +2338,7 @@ NJson::TJsonValue SimplifyQueryPlan(NJson::TJsonValue& plan) {
2321
2338
" ToFlow" ,
2322
2339
" Member" ,
2323
2340
" AssumeSorted"
2324
- };
2341
+ };
2325
2342
2326
2343
THashMap<int , NJson::TJsonValue> planIndex;
2327
2344
THashMap<TString, NJson::TJsonValue> precomputes;
@@ -2357,7 +2374,7 @@ TString AddSimplifiedPlan(const TString& planText, TIntrusivePtr<NOpt::TKqpOptim
2357
2374
optimizerStats[" JoinsCount" ] = optCtx->JoinsCount ;
2358
2375
optimizerStats[" EquiJoinsCount" ] = optCtx->EquiJoinsCount ;
2359
2376
simplifiedPlan[" OptimizerStats" ] = optimizerStats;
2360
- }
2377
+ }
2361
2378
planJson[" SimplifiedPlan" ] = simplifiedPlan;
2362
2379
2363
2380
return planJson.GetStringRobust ();
0 commit comments