Skip to content

Commit cfdb745

Browse files
committed
Remove column_group settings after graph rewrites
commit_hash:c7d005211f2f70b8e4bac2135ab5118312ec8b27
1 parent 68f1305 commit cfdb745

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

yt/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,14 +2721,24 @@ class TYtPhysicalFinalizingTransformer : public TSyncTransformerBase {
27212721
auto newOutput = origOutput;
27222722
for (const auto& item: groupSpecs) {
27232723
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+
}
27322742
}
27332743
}
27342744
if (newOutput != origOutput) {
@@ -2925,14 +2935,12 @@ class TYtPhysicalFinalizingTransformer : public TSyncTransformerBase {
29252935
auto writer = x.first;
29262936
TColumnUsage& usage = x.second;
29272937
if (usage.GenerateGroups) {
2928-
29292938
std::map<size_t, TString> groupSpecs;
29302939
for (size_t i = 0; i < usage.OutTypes.size(); ++i) {
2940+
groupSpecs[i] = TString{};
29312941
if (!usage.PublishUsage[i].empty()) {
29322942
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();
29362944
}
29372945
continue;
29382946
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{"key"="075";"subkey"="1";"value"="abc"};
2+
{"key"="800";"subkey"="2";"value"="ddd"};
3+
{"key"="020";"subkey"="3";"value"="q"};
4+
{"key"="150";"subkey"="4";"value"="qzz"};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
in Input input2.txt
2+
providers yt
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- YQL-19570
2+
-- Expected no column_group in YtMap outputs
3+
USE plato;
4+
5+
pragma yt.ColumnGroupMode="perusage";
6+
pragma yt.OptimizeFor="lookup";
7+
8+
SELECT
9+
key as key,
10+
"" as subkey,
11+
"value:" || value as value
12+
FROM Input
13+
WHERE key < "050"
14+
LIMIT 1;

0 commit comments

Comments
 (0)