Search in sources :

Example 1 with FindPartitionConditions

use of org.apache.drill.exec.planner.logical.partition.FindPartitionConditions in project drill by apache.

the class FilterSplitTest method badFunc.

@Test
public void badFunc() {
    // (dir0 = 1 and dir1 = 2) OR (a < 5)
    RexNode n = fn(cs(0), cs(1));
    BitSet bs = new BitSet();
    bs.set(1);
    bs.set(2);
    FindPartitionConditions c = new FindPartitionConditions(bs, builder);
    c.analyze(n);
    RexNode partNode = c.getFinalCondition();
    assertEquals("||($0, $1)", n.toString());
    assertTrue(partNode == null);
}
Also used : FindPartitionConditions(org.apache.drill.exec.planner.logical.partition.FindPartitionConditions) BitSet(java.util.BitSet) RexNode(org.apache.calcite.rex.RexNode) Test(org.junit.Test)

Example 2 with FindPartitionConditions

use of org.apache.drill.exec.planner.logical.partition.FindPartitionConditions in project drill by apache.

the class FilterSplitTest method simpleCompound.

@Test
public void simpleCompound() {
    // a < 1 AND dir0 in (2,3)
    RexNode n = and(lt(c(0), lit(1)), or(eq(c(1), lit(2)), eq(c(1), lit(3))));
    BitSet bs = new BitSet();
    bs.set(1);
    FindPartitionConditions c = new FindPartitionConditions(bs, builder);
    c.analyze(n);
    RexNode partNode = c.getFinalCondition();
    assertEquals(n.toString(), "AND(<($0, 1), OR(=($1, 2), =($1, 3)))");
    assertEquals(partNode.toString(), "OR(=($1, 2), =($1, 3))");
}
Also used : FindPartitionConditions(org.apache.drill.exec.planner.logical.partition.FindPartitionConditions) BitSet(java.util.BitSet) RexNode(org.apache.calcite.rex.RexNode) Test(org.junit.Test)

Example 3 with FindPartitionConditions

use of org.apache.drill.exec.planner.logical.partition.FindPartitionConditions in project drill by apache.

the class FilterSplitTest method badOr.

@Test
public void badOr() {
    // (dir0 = 1 and dir1 = 2) OR (a < 5)
    RexNode n = or(and(eq(c(1), lit(1)), eq(c(2), lit(2))), lt(c(0), lit(5)));
    BitSet bs = new BitSet();
    bs.set(1);
    bs.set(2);
    FindPartitionConditions c = new FindPartitionConditions(bs, builder);
    c.analyze(n);
    RexNode partNode = c.getFinalCondition();
    assertEquals("OR(AND(=($1, 1), =($2, 2)), <($0, 5))", n.toString());
    assertTrue(partNode == null);
}
Also used : FindPartitionConditions(org.apache.drill.exec.planner.logical.partition.FindPartitionConditions) BitSet(java.util.BitSet) RexNode(org.apache.calcite.rex.RexNode) Test(org.junit.Test)

Example 4 with FindPartitionConditions

use of org.apache.drill.exec.planner.logical.partition.FindPartitionConditions in project drill by apache.

the class FilterSplitTest method twoLevelDir.

@Test
public void twoLevelDir() {
    // (dir0 = 1 and dir1 = 2) OR (dir0 = 3 and dir1 = 4)
    RexNode n = or(and(eq(c(1), lit(1)), eq(c(2), lit(2))), and(eq(c(1), lit(3)), eq(c(2), lit(4))));
    BitSet bs = new BitSet();
    bs.set(1);
    bs.set(2);
    FindPartitionConditions c = new FindPartitionConditions(bs, builder);
    c.analyze(n);
    RexNode partNode = c.getFinalCondition();
    assertEquals("OR(AND(=($1, 1), =($2, 2)), AND(=($1, 3), =($2, 4)))", n.toString());
    assertEquals("OR(AND(=($1, 1), =($2, 2)), AND(=($1, 3), =($2, 4)))", partNode.toString());
}
Also used : FindPartitionConditions(org.apache.drill.exec.planner.logical.partition.FindPartitionConditions) BitSet(java.util.BitSet) RexNode(org.apache.calcite.rex.RexNode) Test(org.junit.Test)

Aggregations

BitSet (java.util.BitSet)4 RexNode (org.apache.calcite.rex.RexNode)4 FindPartitionConditions (org.apache.drill.exec.planner.logical.partition.FindPartitionConditions)4 Test (org.junit.Test)4