Skip to content

Commit 922ce5c

Browse files
authored
[CLI] Bugfix: remove item prefix correctly (#9663)
1 parent d2b896d commit 922ce5c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ydb/public/lib/ydb_cli/common/format.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <iomanip>
1010
#include <strstream>
11+
#include <regex>
1112

1213
namespace NYdb {
1314
namespace NConsoleClient {
@@ -485,15 +486,18 @@ void TQueryPlanPrinter::PrintPrettyTableImpl(const NJson::TJsonValue& plan, TStr
485486
} else if (key == "E-Size") {
486487
eSize = FormatPrettyTableDouble(value.GetString());
487488
} else if (key != "Name") {
489+
std::string valueWithoutInnerVars = JsonToString(value);
490+
valueWithoutInnerVars = std::regex_replace(valueWithoutInnerVars, std::regex(R"((\b(item|state)\.\b))"), "");
491+
488492
if (key == "SsaProgram") {
489493
// skip this attribute
490494
}
491495
else if (key == "Predicate" || key == "Condition" || key == "SortBy") {
492-
info.emplace_back(TStringBuilder() << ReplaceAll(ReplaceAll(JsonToString(value), "item.", ""), "state.", ""));
496+
info.emplace_back(TStringBuilder() << valueWithoutInnerVars);
493497
} else if (key == "Table") {
494-
info.insert(info.begin(), TStringBuilder() << colors.LightYellow() << key << colors.Default() << ":" << colors.LightGreen() << " " << ReplaceAll(ReplaceAll(JsonToString(value), "item.", ""), "state.", "") << colors.Default());
498+
info.insert(info.begin(), TStringBuilder() << colors.LightYellow() << key << colors.Default() << ":" << colors.LightGreen() << " " << valueWithoutInnerVars << colors.Default());
495499
} else {
496-
info.emplace_back(TStringBuilder() << colors.LightYellow() << key << colors.Default() << ": " << ReplaceAll(ReplaceAll(JsonToString(value), "item.", ""), "state.", ""));
500+
info.emplace_back(TStringBuilder() << colors.LightYellow() << key << colors.Default() << ": " << valueWithoutInnerVars);
497501
}
498502
}
499503
}

0 commit comments

Comments
 (0)