Skip to content

Commit 56e8de9

Browse files
authored
API to convert Simplified plan to SVG (#10368)
1 parent a268c7d commit 56e8de9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,11 +1581,12 @@ TPlanViewConfig::TPlanViewConfig() {
15811581
}
15821582

15831583

1584-
void TPlanVisualizer::LoadPlans(const TString& plans) {
1584+
void TPlanVisualizer::LoadPlans(const TString& plans, bool simplified) {
1585+
Config.Simplified = simplified;
15851586
NJson::TJsonReaderConfig jsonConfig;
15861587
NJson::TJsonValue jsonNode;
15871588
if (NJson::ReadJsonTree(plans, &jsonConfig, &jsonNode)) {
1588-
if (auto* topNode = jsonNode.GetValueByPath("Plan")) {
1589+
if (auto* topNode = jsonNode.GetValueByPath(simplified ? "SimplifiedPlan" : "Plan")) {
15891590
if (auto* subNode = topNode->GetValueByPath("Plans")) {
15901591
for (auto& plan : subNode->GetArray()) {
15911592
if (auto* typeNode = plan.GetValueByPath("Node Type")) {

ydb/public/lib/ydb_cli/common/plan2svg.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ struct TPlanViewConfig {
183183
ui32 SummaryWidth;
184184
ui32 Width;
185185
TColorPalette Palette;
186+
bool Simplified = false;
186187
};
187188

188189
class TPlan {
@@ -250,7 +251,7 @@ class TPlanVisualizer {
250251

251252
public:
252253

253-
void LoadPlans(const TString& plans);
254+
void LoadPlans(const TString& plans, bool simplified = false);
254255
void LoadPlan(const TString& planNodeType, const NJson::TJsonValue& root);
255256
void PostProcessPlans();
256257
TString PrintSvg();

0 commit comments

Comments
 (0)