Skip to content

Commit a020570

Browse files
committed
Fix rendering for WITH RECURSIVE
1 parent 1fab63d commit a020570

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

plan-dumper/queries/cte-recursive.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
WITH RECURSIVE x(i) AS (
2+
SELECT 1
3+
UNION ALL
4+
SELECT i + 1 FROM x WHERE i < 100
5+
)
6+
SELECT * FROM x;

query-graphs/src/hyper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const nodeRenderingConfig: Record<string, NodeRenderingConfig> = {
8282
// Temp & Explicit scan
8383
"op:explicitscan": {icon: "temp-table-symbol", crosslinkSourceKey: "input"},
8484
"op:temp": {icon: "temp-table-symbol"},
85+
"op:iterationincrement": {crosslinkSourceKey: "source"},
8586
// Expressions
8687
"exp:comparison": {displayNameKey: "mode"},
8788
"exp:iuref": {displayNameKey: "iu"},
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"operator": "executiontarget",
3+
"operatorId": 1,
4+
"cardinality": 11,
5+
"producesRows": true,
6+
"output": [{"expression": "iuref", "iu": ["v", ["Integer"]]}],
7+
"outputNames": ["i"],
8+
"input": {
9+
"operator": "iteration",
10+
"operatorId": 2,
11+
"cardinality": 11,
12+
"resultIUs": [["v", ["Integer"]]],
13+
"leftValues": [{"expression": "iuref", "iu": ["v2", ["Integer"]]}],
14+
"rightValues": [{"expression": "iuref", "iu": ["v3", ["Integer"]]}],
15+
"unionAll": true,
16+
"left": {
17+
"operator": "tableconstruction",
18+
"operatorId": 3,
19+
"cardinality": 1,
20+
"output": [["v2", ["Integer"]]],
21+
"values": [[{"expression": "const", "value": {"type": ["Integer"], "value": 1}}]]
22+
},
23+
"right": {
24+
"operator": "map",
25+
"operatorId": 4,
26+
"sqlpos": [[85, 90]],
27+
"cardinality": 1,
28+
"input": {
29+
"operator": "select",
30+
"operatorId": 5,
31+
"sqlpos": [[104, 111]],
32+
"cardinality": 1,
33+
"input": {
34+
"operator": "iterationincrement",
35+
"operatorId": 6,
36+
"sqlpos": [[96, 97]],
37+
"cardinality": 1,
38+
"values": [["v4", ["Integer"]]],
39+
"source": 2
40+
},
41+
"condition": {"expression": "comparison", "mode": "<", "left": {"expression": "iuref", "iu": "v4"}, "right": {"expression": "const", "value": {"type": ["Integer"], "value": 100}}}
42+
},
43+
"values": [{"iu": ["v3", ["Integer"]], "value": {"expression": "add", "left": {"expression": "iuref", "iu": "v4"}, "right": {"expression": "const", "value": {"type": ["Integer"], "value": 1}}}}]
44+
},
45+
"collates": [null]
46+
}
47+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"Plan": {"Node Type": "CTE Scan", "Parallel Aware": false, "Async Capable": false, "CTE Name": "x", "Alias": "x", "Startup Cost": 2.64, "Total Cost": 3.26, "Plan Rows": 31, "Plan Width": 4, "Output": ["x.i"], "Plans": [{"Node Type": "Recursive Union", "Parent Relationship": "InitPlan", "Subplan Name": "CTE x", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.0, "Total Cost": 2.64, "Plan Rows": 31, "Plan Width": 4, "Plans": [{"Node Type": "Result", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.0, "Total Cost": 0.01, "Plan Rows": 1, "Plan Width": 4, "Output": ["1"]}, {"Node Type": "WorkTable Scan", "Parent Relationship": "Inner", "Parallel Aware": false, "Async Capable": false, "CTE Name": "x", "Alias": "x_1", "Startup Cost": 0.0, "Total Cost": 0.23, "Plan Rows": 3, "Plan Width": 4, "Output": ["(x_1.i + 1)"], "Filter": "(x_1.i < 100)"}]}]}}]

0 commit comments

Comments
 (0)