Skip to content

Commit 538e10a

Browse files
committed
Add insta snapshots for FORMAT TREE integration tests
1 parent a140df6 commit 538e10a

5 files changed

Lines changed: 141 additions & 10 deletions

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ballista/client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ ballista-scheduler = { path = "../scheduler", version = "52.0.0" }
4646
ctor = { workspace = true }
4747
datafusion-proto = { workspace = true }
4848
env_logger = { workspace = true }
49+
insta = { workspace = true }
4950
rstest = { workspace = true }
5051
tempfile = { workspace = true }
5152
tonic = { workspace = true }

ballista/client/tests/context_checks.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,17 +1150,12 @@ mod supported {
11501150
.unwrap();
11511151

11521152
let physical_plan_txt = plan_arr.value(0);
1153-
// Tree format uses box drawing characters like ┌, ─, ┐, │, └, ┘.
1154-
assert!(
1155-
physical_plan_txt.contains('┌') || physical_plan_txt.contains('│'),
1156-
"Expected tree format with box characters in physical_plan, got: {physical_plan_txt}"
1157-
);
1158-
11591153
let distributed_plan_txt = plan_arr.value(1);
1160-
assert!(
1161-
!distributed_plan_txt.is_empty(),
1162-
"Expected non-empty distributed_plan"
1163-
);
1154+
1155+
// Snapshot the tree-rendered plans. Both standalone and remote cases
1156+
// should produce identical output, validating the codec round-trip.
1157+
insta::assert_snapshot!("explain_format_tree_physical_plan", physical_plan_txt);
1158+
insta::assert_snapshot!("explain_format_tree_distributed_plan", distributed_plan_txt);
11641159
}
11651160

11661161
#[rstest]
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
source: ballista/client/tests/context_checks.rs
3+
expression: distributed_plan_txt
4+
---
5+
=========ResolvedStage[stage_id=1.0, partitions=1]=========
6+
┌───────────────────────────┐
7+
ShuffleWriterExec
8+
--------------------
9+
partitioning: │
10+
Hash([id@0], 16) │
11+
└─────────────┬─────────────┘
12+
┌─────────────┴─────────────┐
13+
AggregateExec
14+
--------------------
15+
aggr: count(1) │
16+
group_by: id
17+
mode: Partial
18+
└─────────────┬─────────────┘
19+
┌─────────────┴─────────────┐
20+
ProjectionExec
21+
--------------------
22+
id: │
23+
__unnest_placeholder
24+
│ (make_array(Int64(1
25+
│ ),Int64(2),Int64(3),Int64
26+
│ (4),Int64(5)),depth=1) │
27+
└─────────────┬─────────────┘
28+
┌─────────────┴─────────────┐
29+
UnnestExec
30+
└─────────────┬─────────────┘
31+
┌─────────────┴─────────────┐
32+
ProjectionExec
33+
--------------------
34+
__unnest_placeholder
35+
│ (make_array(Int64(1
36+
│ ),Int64(2),Int64(3),Int64
37+
│ (4),Int64(5))): │
38+
│ [1, 2, 3, 4, 5] │
39+
└─────────────┬─────────────┘
40+
┌─────────────┴─────────────┐
41+
PlaceholderRowExec
42+
└───────────────────────────┘
43+
44+
=========UnResolvedStage[stage_id=2.0, children=1]=========
45+
Inputs{1: StageOutput { partition_locations: {}, complete: false }}
46+
┌───────────────────────────┐
47+
ShuffleWriterExec
48+
--------------------
49+
partitioning: None
50+
└─────────────┬─────────────┘
51+
┌─────────────┴─────────────┐
52+
ProjectionExec
53+
--------------------
54+
count(*): │
55+
count(Int64(1)) │
56+
│ │
57+
id: id
58+
└─────────────┬─────────────┘
59+
┌─────────────┴─────────────┐
60+
AggregateExec
61+
--------------------
62+
aggr: count(1) │
63+
group_by: id
64+
│ │
65+
mode: │
66+
FinalPartitioned
67+
└─────────────┬─────────────┘
68+
┌─────────────┴─────────────┐
69+
UnresolvedShuffleExec
70+
--------------------
71+
partitioning: │
72+
Hash([id@0], 16) │
73+
└───────────────────────────┘
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
source: ballista/client/tests/context_checks.rs
3+
expression: physical_plan_txt
4+
---
5+
┌───────────────────────────┐
6+
ProjectionExec
7+
--------------------
8+
count(*): │
9+
count(Int64(1)) │
10+
│ │
11+
id: id
12+
└─────────────┬─────────────┘
13+
┌─────────────┴─────────────┐
14+
AggregateExec
15+
--------------------
16+
aggr: count(1) │
17+
group_by: id
18+
│ │
19+
mode: │
20+
FinalPartitioned
21+
└─────────────┬─────────────┘
22+
┌─────────────┴─────────────┐
23+
RepartitionExec
24+
--------------------
25+
partition_count(in->out): │
26+
1 -> 16
27+
│ │
28+
partitioning_scheme: │
29+
Hash([id@0], 16) │
30+
└─────────────┬─────────────┘
31+
┌─────────────┴─────────────┐
32+
AggregateExec
33+
--------------------
34+
aggr: count(1) │
35+
group_by: id
36+
mode: Partial
37+
└─────────────┬─────────────┘
38+
┌─────────────┴─────────────┐
39+
ProjectionExec
40+
--------------------
41+
id: │
42+
__unnest_placeholder
43+
│ (make_array(Int64(1
44+
│ ),Int64(2),Int64(3),Int64
45+
│ (4),Int64(5)),depth=1) │
46+
└─────────────┬─────────────┘
47+
┌─────────────┴─────────────┐
48+
UnnestExec
49+
└─────────────┬─────────────┘
50+
┌─────────────┴─────────────┐
51+
ProjectionExec
52+
--------------------
53+
__unnest_placeholder
54+
│ (make_array(Int64(1
55+
│ ),Int64(2),Int64(3),Int64
56+
│ (4),Int64(5))): │
57+
│ [1, 2, 3, 4, 5] │
58+
└─────────────┬─────────────┘
59+
┌─────────────┴─────────────┐
60+
PlaceholderRowExec
61+
└───────────────────────────┘

0 commit comments

Comments
 (0)