Search in sources :

Example 16 with Node

use of io.confluent.ksql.planner.JoinTree.Node in project ksql by confluentinc.

the class JoinTreeTest method shouldComputeEquivalenceSetWithoutOverlap.

@Test
public void shouldComputeEquivalenceSetWithoutOverlap() {
    // Given:
    when(j1.getLeftSource()).thenReturn(a);
    when(j1.getRightSource()).thenReturn(b);
    when(j2.getLeftSource()).thenReturn(a);
    when(j2.getRightSource()).thenReturn(c);
    when(j1.getLeftJoinExpression()).thenReturn(e1);
    when(j1.getRightJoinExpression()).thenReturn(e2);
    when(j2.getLeftJoinExpression()).thenReturn(e3);
    when(j2.getRightJoinExpression()).thenReturn(e4);
    final List<JoinInfo> joins = ImmutableList.of(j1, j2);
    // When:
    final Node root = JoinTree.build(joins);
    // Then:
    assertThat(root.joinEquivalenceSet(), containsInAnyOrder(e3, e4));
}
Also used : JoinInfo(io.confluent.ksql.analyzer.Analysis.JoinInfo) Node(io.confluent.ksql.planner.JoinTree.Node) Test(org.junit.Test)

Aggregations

Node (io.confluent.ksql.planner.JoinTree.Node)16 Test (org.junit.Test)16 JoinInfo (io.confluent.ksql.analyzer.Analysis.JoinInfo)15 Join (io.confluent.ksql.planner.JoinTree.Join)3 Leaf (io.confluent.ksql.planner.JoinTree.Leaf)3