@@ -2721,14 +2721,24 @@ class TYtPhysicalFinalizingTransformer : public TSyncTransformerBase {
2721
2721
auto newOutput = origOutput;
2722
2722
for (const auto & item: groupSpecs) {
2723
2723
const auto table = op.Output ().Item (item.first );
2724
- auto currentGroup = GetSetting (table.Settings ().Ref (), EYtSettingType::ColumnGroups);
2725
- if (!currentGroup || currentGroup->Tail ().Content () != item.second ) {
2726
- auto newSettings = AddOrUpdateSettingValue (table.Settings ().Ref (),
2727
- EYtSettingType::ColumnGroups,
2728
- ctx.NewAtom (table.Settings ().Pos (), item.second , TNodeFlags::MultilineContent),
2729
- ctx);
2730
- auto newTable = ctx.ChangeChild (table.Ref (), TYtOutTable::idx_Settings, std::move (newSettings));
2731
- newOutput = ctx.ChangeChild (*newOutput, item.first , std::move (newTable));
2724
+ if (item.second .empty ()) {
2725
+ if (NYql::HasSetting (table.Settings ().Ref (), EYtSettingType::ColumnGroups)) {
2726
+ newOutput = ctx.ChangeChild (*newOutput, item.first ,
2727
+ ctx.ChangeChild (table.Ref (), TYtOutTable::idx_Settings,
2728
+ NYql::RemoveSetting (table.Settings ().Ref (), EYtSettingType::ColumnGroups, ctx)
2729
+ )
2730
+ );
2731
+ }
2732
+ } else {
2733
+ auto currentGroup = NYql::GetSetting (table.Settings ().Ref (), EYtSettingType::ColumnGroups);
2734
+ if (!currentGroup || currentGroup->Tail ().Content () != item.second ) {
2735
+ auto newSettings = NYql::AddOrUpdateSettingValue (table.Settings ().Ref (),
2736
+ EYtSettingType::ColumnGroups,
2737
+ ctx.NewAtom (table.Settings ().Pos (), item.second , TNodeFlags::MultilineContent),
2738
+ ctx);
2739
+ auto newTable = ctx.ChangeChild (table.Ref (), TYtOutTable::idx_Settings, std::move (newSettings));
2740
+ newOutput = ctx.ChangeChild (*newOutput, item.first , std::move (newTable));
2741
+ }
2732
2742
}
2733
2743
}
2734
2744
if (newOutput != origOutput) {
@@ -2925,14 +2935,12 @@ class TYtPhysicalFinalizingTransformer : public TSyncTransformerBase {
2925
2935
auto writer = x.first ;
2926
2936
TColumnUsage& usage = x.second ;
2927
2937
if (usage.GenerateGroups ) {
2928
-
2929
2938
std::map<size_t , TString> groupSpecs;
2930
2939
for (size_t i = 0 ; i < usage.OutTypes .size (); ++i) {
2940
+ groupSpecs[i] = TString{};
2931
2941
if (!usage.PublishUsage [i].empty ()) {
2932
2942
if (usage.PublishUsage [i].size () == 1 ) {
2933
- if (auto spec = *usage.PublishUsage [i].cbegin (); !spec.empty ()) {
2934
- groupSpecs[i] = spec;
2935
- }
2943
+ groupSpecs[i] = *usage.PublishUsage [i].cbegin ();
2936
2944
}
2937
2945
continue ;
2938
2946
}
0 commit comments