Search in sources :

Example 1 with JoinPair

use of io.crate.analyze.relations.JoinPair in project crate by crate.

the class ManyTableConsumerTest method testOptimizeJoinNoPresort.

@Test
public void testOptimizeJoinNoPresort() throws Exception {
    JoinPair pair1 = new JoinPair(T3.T1, T3.T2, JoinType.CROSS);
    JoinPair pair2 = new JoinPair(T3.T2, T3.T3, JoinType.CROSS);
    @SuppressWarnings("unchecked") Collection<QualifiedName> qualifiedNames = ManyTableConsumer.orderByJoinConditions(Arrays.asList(T3.T1, T3.T2, T3.T3), ImmutableSet.<Set<QualifiedName>>of(), ImmutableList.of(pair1, pair2), ImmutableList.<QualifiedName>of());
    assertThat(qualifiedNames, Matchers.contains(T3.T1, T3.T2, T3.T3));
}
Also used : QualifiedName(io.crate.sql.tree.QualifiedName) JoinPair(io.crate.analyze.relations.JoinPair) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 2 with JoinPair

use of io.crate.analyze.relations.JoinPair in project crate by crate.

the class ManyTableConsumerTest method testNoOptimizeWithSortingAndOuterJoin.

@Test
public void testNoOptimizeWithSortingAndOuterJoin() throws Exception {
    JoinPair pair1 = new JoinPair(T3.T1, T3.T2, JoinType.LEFT);
    JoinPair pair2 = new JoinPair(T3.T2, T3.T3, JoinType.LEFT);
    @SuppressWarnings("unchecked") Collection<QualifiedName> qualifiedNames = ManyTableConsumer.orderByJoinConditions(Arrays.asList(T3.T1, T3.T2, T3.T3), ImmutableSet.<Set<QualifiedName>>of(), ImmutableList.of(pair1, pair2), ImmutableList.of(T3.T3, T3.T2));
    assertThat(qualifiedNames, Matchers.contains(T3.T1, T3.T2, T3.T3));
}
Also used : QualifiedName(io.crate.sql.tree.QualifiedName) JoinPair(io.crate.analyze.relations.JoinPair) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

JoinPair (io.crate.analyze.relations.JoinPair)2 QualifiedName (io.crate.sql.tree.QualifiedName)2 CrateUnitTest (io.crate.test.integration.CrateUnitTest)2 Test (org.junit.Test)2