@@ -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
}
@@ -1376,7 +1393,7 @@ class TxPlanSerializer {
1376
1393
1377
1394
TOperator op;
1378
1395
op.Properties [" Name" ] = name;
1379
-
1396
+
1380
1397
return AddOperator (planNode, name, std::move (op));
1381
1398
}
1382
1399
@@ -1728,8 +1745,8 @@ class TxPlanSerializer {
1728
1745
1729
1746
template <typename TReadTableSettings>
1730
1747
void AddReadTableSettings (
1731
- TOperator& op,
1732
- const TReadTableSettings& readTableSettings,
1748
+ TOperator& op,
1749
+ const TReadTableSettings& readTableSettings,
1733
1750
TTableRead& readInfo
1734
1751
) {
1735
1752
auto settings = NYql::TKqpReadTableSettings::Parse (readTableSettings);
@@ -1751,9 +1768,9 @@ class TxPlanSerializer {
1751
1768
}
1752
1769
1753
1770
if (settings.SequentialInFlight ) {
1754
- op.Properties [" Scan" ] = " Sequential" ;
1771
+ op.Properties [" Scan" ] = " Sequential" ;
1755
1772
} else {
1756
- op.Properties [" Scan" ] = " Parallel" ;
1773
+ op.Properties [" Scan" ] = " Parallel" ;
1757
1774
}
1758
1775
}
1759
1776
@@ -1953,8 +1970,8 @@ TVector<NJson::TJsonValue> RemoveRedundantNodes(NJson::TJsonValue& plan, const T
1953
1970
return {plan};
1954
1971
}
1955
1972
1956
- NJson::TJsonValue ReconstructQueryPlanRec (const NJson::TJsonValue& plan,
1957
- int operatorIndex,
1973
+ NJson::TJsonValue ReconstructQueryPlanRec (const NJson::TJsonValue& plan,
1974
+ int operatorIndex,
1958
1975
const THashMap<int , NJson::TJsonValue>& planIndex,
1959
1976
const THashMap<TString, NJson::TJsonValue>& precomputes,
1960
1977
int & nodeCounter) {
@@ -1993,14 +2010,14 @@ NJson::TJsonValue ReconstructQueryPlanRec(const NJson::TJsonValue& plan,
1993
2010
NJson::TJsonValue newOps;
1994
2011
NJson::TJsonValue op;
1995
2012
1996
- op[" Name" ] = " TableLookup" ;
2013
+ op[" Name" ] = " TableLookup" ;
1997
2014
op[" Columns" ] = plan.GetMapSafe ().at (" Columns" );
1998
2015
op[" LookupKeyColumns" ] = plan.GetMapSafe ().at (" LookupKeyColumns" );
1999
2016
op[" Table" ] = plan.GetMapSafe ().at (" Table" );
2000
2017
2001
2018
if (plan.GetMapSafe ().contains (" E-Cost" )) {
2002
2019
op[" E-Cost" ] = plan.GetMapSafe ().at (" E-Cost" );
2003
- }
2020
+ }
2004
2021
if (plan.GetMapSafe ().contains (" E-Rows" )) {
2005
2022
op[" E-Rows" ] = plan.GetMapSafe ().at (" E-Rows" );
2006
2023
}
@@ -2075,8 +2092,8 @@ NJson::TJsonValue ReconstructQueryPlanRec(const NJson::TJsonValue& plan,
2075
2092
op.GetMapSafe ().erase (" Inputs" );
2076
2093
}
2077
2094
2078
- if (op.GetMapSafe ().contains (" Input" )
2079
- || op.GetMapSafe ().contains (" ToFlow" )
2095
+ if (op.GetMapSafe ().contains (" Input" )
2096
+ || op.GetMapSafe ().contains (" ToFlow" )
2080
2097
|| op.GetMapSafe ().contains (" Member" )
2081
2098
|| op.GetMapSafe ().contains (" AssumeSorted" )
2082
2099
|| op.GetMapSafe ().contains (" Iterator" )) {
@@ -2149,7 +2166,7 @@ double ComputeCpuTimes(NJson::TJsonValue& plan) {
2149
2166
}
2150
2167
2151
2168
void ComputeTotalRows (NJson::TJsonValue& plan) {
2152
-
2169
+
2153
2170
if (plan.GetMapSafe ().contains (" Plans" )) {
2154
2171
for (auto & p : plan.GetMapSafe ().at (" Plans" ).GetArraySafe ()) {
2155
2172
ComputeTotalRows (p);
@@ -2201,7 +2218,7 @@ NJson::TJsonValue SimplifyQueryPlan(NJson::TJsonValue& plan) {
2201
2218
" ToFlow" ,
2202
2219
" Member" ,
2203
2220
" AssumeSorted"
2204
- };
2221
+ };
2205
2222
2206
2223
THashMap<int , NJson::TJsonValue> planIndex;
2207
2224
THashMap<TString, NJson::TJsonValue> precomputes;
@@ -2237,7 +2254,7 @@ TString AddSimplifiedPlan(const TString& planText, TIntrusivePtr<NOpt::TKqpOptim
2237
2254
optimizerStats[" JoinsCount" ] = optCtx->JoinsCount ;
2238
2255
optimizerStats[" EquiJoinsCount" ] = optCtx->EquiJoinsCount ;
2239
2256
simplifiedPlan[" OptimizerStats" ] = optimizerStats;
2240
- }
2257
+ }
2241
2258
planJson[" SimplifiedPlan" ] = simplifiedPlan;
2242
2259
2243
2260
return planJson.GetStringRobust ();
0 commit comments