agora inbox for [email protected]
help / color / mirror / Atom feedFrom: Justin Pryzby <[email protected]>
Subject: [PATCH v5 2/7] refactor show_grouping_set_keys
Date: Sun, 23 Feb 2020 23:13:07 -0600
---
src/backend/commands/explain.c | 55 +++++++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 22 deletions(-)
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index ff22181..f416f60 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -95,6 +95,8 @@ static void show_grouping_set_info(AggState *aggstate,
List *ancestors,
HashTableInstrumentation *inst,
ExplainState *es);
+static void show_grouping_set_keys(AggState *aggstate, Agg *aggnode, List
+ *context, bool useprefix, ExplainState *es);
static void show_group_keys(GroupState *gstate, List *ancestors,
ExplainState *es);
static void show_sort_group_keys(PlanState *planstate, const char *qlabel,
@@ -2350,6 +2352,37 @@ show_grouping_set_info(AggState *aggstate,
ExplainState *es)
{
PlanState *planstate = outerPlanState(aggstate);
+
+ ExplainOpenGroup("Grouping Set", NULL, true, es);
+
+ if (sortnode)
+ {
+ show_sort_group_keys(planstate, "Sort Key",
+ sortnode->numCols, sortnode->sortColIdx,
+ sortnode->sortOperators, sortnode->collations,
+ sortnode->nullsFirst,
+ ancestors, es);
+ if (es->format == EXPLAIN_FORMAT_TEXT)
+ es->indent++;
+ }
+
+ show_grouping_set_keys(aggstate, aggnode, context, useprefix, es);
+
+ if (aggnode->aggstrategy == AGG_HASHED ||
+ aggnode->aggstrategy == AGG_MIXED)
+ show_tuplehash_info(inst, es);
+
+ if (sortnode && es->format == EXPLAIN_FORMAT_TEXT)
+ es->indent--;
+
+ ExplainCloseGroup("Grouping Set", NULL, true, es);
+}
+
+/* Show keys of a grouping set */
+static void
+show_grouping_set_keys(AggState *aggstate, Agg *aggnode, List *context, bool useprefix, ExplainState *es)
+{
+ PlanState *planstate = outerPlanState(aggstate);
Plan *plan = planstate->plan;
char *exprstr;
ListCell *lc;
@@ -2369,19 +2402,6 @@ show_grouping_set_info(AggState *aggstate,
keysetname = "Group Keys";
}
- ExplainOpenGroup("Grouping Set", NULL, true, es);
-
- if (sortnode)
- {
- show_sort_group_keys(planstate, "Sort Key",
- sortnode->numCols, sortnode->sortColIdx,
- sortnode->sortOperators, sortnode->collations,
- sortnode->nullsFirst,
- ancestors, es);
- if (es->format == EXPLAIN_FORMAT_TEXT)
- es->indent++;
- }
-
ExplainOpenGroup(keysetname, keysetname, false, es);
foreach(lc, gsets)
@@ -2412,15 +2432,6 @@ show_grouping_set_info(AggState *aggstate,
}
ExplainCloseGroup(keysetname, keysetname, false, es);
-
- if (aggnode->aggstrategy == AGG_HASHED ||
- aggnode->aggstrategy == AGG_MIXED)
- show_tuplehash_info(inst, es);
-
- if (sortnode && es->format == EXPLAIN_FORMAT_TEXT)
- es->indent--;
-
- ExplainCloseGroup("Grouping Set", NULL, true, es);
}
/*
--
2.7.4
--M0YLxmUXciMpOLPE
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v5-0003-Gross-hack-to-put-hash-stats-of-subplans-in-the-r.patch"
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH v5 2/7] refactor show_grouping_set_keys
In-Reply-To: <no-message-id-189090@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox