Search in sources :

Example 6 with CopierTester

use of org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester in project drill by axbaretto.

the class TestCopier method testMultipleOutputDesc.

// Also verifies that SV2s work
@Test
public void testMultipleOutputDesc() throws Exception {
    BatchSchema schema = SortTestUtilities.nonNullSchema();
    CopierTester tester = new CopierTester(fixture);
    tester.sortOrder = Ordering.ORDER_DESC;
    tester.nullOrder = Ordering.NULLS_UNSPECIFIED;
    SingleRowSet input = makeDataSet(schema, 0, 2, 10).toIndirect();
    RowSetUtilities.reverse(input.getSv2());
    tester.addInput(input);
    input = makeDataSet(schema, 1, 2, 10).toIndirect();
    RowSetUtilities.reverse(input.getSv2());
    tester.addInput(input);
    tester.addOutput(makeDataSet(schema, 19, -1, 10));
    tester.addOutput(makeDataSet(schema, 9, -1, 10));
    tester.run();
}
Also used : SingleRowSet(org.apache.drill.test.rowSet.RowSet.SingleRowSet) BatchSchema(org.apache.drill.exec.record.BatchSchema) CopierTester(org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester) OperatorTest(org.apache.drill.categories.OperatorTest) SubOperatorTest(org.apache.drill.test.SubOperatorTest) Test(org.junit.Test)

Example 7 with CopierTester

use of org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester in project drill by axbaretto.

the class TestCopier method testDescNullsLast.

@Test
public void testDescNullsLast() throws Exception {
    BatchSchema schema = SortTestUtilities.nullableSchema();
    CopierTester tester = new CopierTester(fixture);
    tester.sortOrder = Ordering.ORDER_DESC;
    tester.nullOrder = Ordering.NULLS_LAST;
    tester.addInput(fixture.rowSetBuilder(schema).addRow(4, "4").addRow(1, "1").addRow(null, "null").withSv2().build());
    tester.addInput(fixture.rowSetBuilder(schema).addRow(3, "3").addRow(2, "2").addRow(null, "null").withSv2().build());
    tester.addOutput(fixture.rowSetBuilder(schema).addRow(4, "4").addRow(3, "3").addRow(2, "2").addRow(1, "1").addRow(null, "null").addRow(null, "null").build());
    tester.run();
}
Also used : BatchSchema(org.apache.drill.exec.record.BatchSchema) CopierTester(org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester) OperatorTest(org.apache.drill.categories.OperatorTest) SubOperatorTest(org.apache.drill.test.SubOperatorTest) Test(org.junit.Test)

Example 8 with CopierTester

use of org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester in project drill by axbaretto.

the class TestCopier method testTwoBatchesSingleRow.

@Test
public void testTwoBatchesSingleRow() throws Exception {
    BatchSchema schema = SortTestUtilities.nonNullSchema();
    CopierTester tester = new CopierTester(fixture);
    tester.addInput(fixture.rowSetBuilder(schema).addRow(10, "10").withSv2().build());
    tester.addInput(fixture.rowSetBuilder(schema).addRow(20, "20").withSv2().build());
    tester.addOutput(fixture.rowSetBuilder(schema).addRow(10, "10").addRow(20, "20").build());
    tester.run();
}
Also used : BatchSchema(org.apache.drill.exec.record.BatchSchema) CopierTester(org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester) OperatorTest(org.apache.drill.categories.OperatorTest) SubOperatorTest(org.apache.drill.test.SubOperatorTest) Test(org.junit.Test)

Example 9 with CopierTester

use of org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester in project drill by axbaretto.

the class TestCopier method runTypeTest.

public static void runTypeTest(OperatorFixture fixture, MinorType type) throws Exception {
    BatchSchema schema = SortTestUtilities.makeSchema(type, false);
    CopierTester tester = new CopierTester(fixture);
    tester.addInput(makeDataSet(schema, 0, 2, 5).toIndirect());
    tester.addInput(makeDataSet(schema, 1, 2, 5).toIndirect());
    tester.addOutput(makeDataSet(schema, 0, 1, 10));
    tester.run();
}
Also used : BatchSchema(org.apache.drill.exec.record.BatchSchema) CopierTester(org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester)

Example 10 with CopierTester

use of org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester in project drill by axbaretto.

the class TestCopier method testDescNullsFirst.

@Test
public void testDescNullsFirst() throws Exception {
    BatchSchema schema = SortTestUtilities.nullableSchema();
    CopierTester tester = new CopierTester(fixture);
    tester.sortOrder = Ordering.ORDER_DESC;
    tester.nullOrder = Ordering.NULLS_FIRST;
    tester.addInput(fixture.rowSetBuilder(schema).addRow(null, "null").addRow(4, "4").addRow(1, "1").withSv2().build());
    tester.addInput(fixture.rowSetBuilder(schema).addRow(null, "null").addRow(3, "3").addRow(2, "2").withSv2().build());
    tester.addOutput(fixture.rowSetBuilder(schema).addRow(null, "null").addRow(null, "null").addRow(4, "4").addRow(3, "3").addRow(2, "2").addRow(1, "1").build());
    tester.run();
}
Also used : BatchSchema(org.apache.drill.exec.record.BatchSchema) CopierTester(org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester) OperatorTest(org.apache.drill.categories.OperatorTest) SubOperatorTest(org.apache.drill.test.SubOperatorTest) Test(org.junit.Test)

Aggregations

CopierTester (org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester)11 BatchSchema (org.apache.drill.exec.record.BatchSchema)11 OperatorTest (org.apache.drill.categories.OperatorTest)9 SubOperatorTest (org.apache.drill.test.SubOperatorTest)9 Test (org.junit.Test)9 SingleRowSet (org.apache.drill.test.rowSet.RowSet.SingleRowSet)1 SchemaBuilder (org.apache.drill.test.rowSet.schema.SchemaBuilder)1