Skip to content

Commit cb21a40

Browse files
committed
Extend TestSchedulingUtils with top level union
1 parent cf6be86 commit cb21a40

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

core/trino-main/src/test/java/io/trino/execution/scheduler/TestSchedulingUtils.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,34 @@ public void testCanStreamNoJoin()
7272
assertThat(SchedulingUtils.canStream(parentSubPlan, valuesSubPlan("a"))).isTrue();
7373
}
7474

75+
@Test
76+
public void testCanStreamUnion()
77+
{
78+
/*
79+
parent(union)
80+
/ \ \
81+
-------------------------------------- stage boundary
82+
a b c
83+
*/
84+
SubPlan aSubPlan = valuesSubPlan("a");
85+
RemoteSourceNode remoteSourceA = remoteSource("a");
86+
87+
SubPlan bSubPlan = valuesSubPlan("b");
88+
RemoteSourceNode remoteSourceB = remoteSource("b");
89+
90+
SubPlan cSubPlan = valuesSubPlan("c");
91+
RemoteSourceNode remoteSourceC = remoteSource("c");
92+
93+
SubPlan parentSubPlan = createSubPlan(
94+
"parent",
95+
union("union", ImmutableList.of(remoteSourceA, remoteSourceB, remoteSourceC)),
96+
ImmutableList.of(aSubPlan, bSubPlan));
97+
98+
assertThat(SchedulingUtils.canStream(parentSubPlan, aSubPlan)).isTrue();
99+
assertThat(SchedulingUtils.canStream(parentSubPlan, bSubPlan)).isTrue();
100+
assertThat(SchedulingUtils.canStream(parentSubPlan, cSubPlan)).isTrue();
101+
}
102+
75103
@Test
76104
public void testCanStreamJoin()
77105
{

0 commit comments

Comments
 (0)