Search in sources :

Example 1 with CopierTester

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

the class TestCopier method testMapType.

public void testMapType(OperatorFixture fixture) throws Exception {
    BatchSchema schema = new SchemaBuilder().add("key", MinorType.INT).addMap("m1").add("b", MinorType.INT).addMap("m2").add("c", MinorType.INT).resumeMap().resumeSchema().build();
    CopierTester tester = new CopierTester(fixture);
    tester.addInput(fixture.rowSetBuilder(schema).addRow(1, objArray(10, objArray(100))).addRow(5, objArray(50, objArray(500))).withSv2().build());
    tester.addInput(fixture.rowSetBuilder(schema).addRow(2, objArray(20, objArray(200))).addRow(6, objArray(60, objArray(600))).withSv2().build());
    tester.addOutput(fixture.rowSetBuilder(schema).addRow(1, objArray(10, objArray(100))).addRow(2, objArray(20, objArray(200))).addRow(5, objArray(50, objArray(500))).addRow(6, objArray(60, objArray(600))).build());
    tester.run();
}
Also used : BatchSchema(org.apache.drill.exec.record.BatchSchema) CopierTester(org.apache.drill.exec.physical.impl.xsort.managed.SortTestUtilities.CopierTester) SchemaBuilder(org.apache.drill.test.rowSet.schema.SchemaBuilder)

Example 2 with CopierTester

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

the class TestCopier method testEmptyBatch.

@Test
public void testEmptyBatch() throws Exception {
    BatchSchema schema = SortTestUtilities.nonNullSchema();
    CopierTester tester = new CopierTester(fixture);
    tester.addInput(fixture.rowSetBuilder(schema).withSv2().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 3 with CopierTester

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

the class TestCopier method testAscNullsLast.

@Test
public void testAscNullsLast() throws Exception {
    BatchSchema schema = SortTestUtilities.nullableSchema();
    CopierTester tester = new CopierTester(fixture);
    tester.sortOrder = Ordering.ORDER_ASC;
    tester.nullOrder = Ordering.NULLS_LAST;
    tester.addInput(fixture.rowSetBuilder(schema).addRow(1, "1").addRow(4, "4").addRow(null, "null").withSv2().build());
    tester.addInput(fixture.rowSetBuilder(schema).addRow(2, "2").addRow(3, "3").addRow(null, "null").withSv2().build());
    tester.addOutput(fixture.rowSetBuilder(schema).addRow(1, "1").addRow(2, "2").addRow(3, "3").addRow(4, "4").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 4 with CopierTester

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

the class TestCopier method testAscNullsFirst.

@Test
public void testAscNullsFirst() throws Exception {
    BatchSchema schema = SortTestUtilities.nullableSchema();
    CopierTester tester = new CopierTester(fixture);
    tester.sortOrder = Ordering.ORDER_ASC;
    tester.nullOrder = Ordering.NULLS_FIRST;
    tester.addInput(fixture.rowSetBuilder(schema).addRow(null, "null").addRow(1, "1").addRow(4, "4").withSv2().build());
    tester.addInput(fixture.rowSetBuilder(schema).addRow(null, "null").addRow(2, "2").addRow(3, "3").withSv2().build());
    tester.addOutput(fixture.rowSetBuilder(schema).addRow(null, "null").addRow(null, "null").addRow(1, "1").addRow(2, "2").addRow(3, "3").addRow(4, "4").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 5 with CopierTester

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

the class TestCopier method testMultipleOutput.

@Test
public void testMultipleOutput() throws Exception {
    BatchSchema schema = SortTestUtilities.nonNullSchema();
    CopierTester tester = new CopierTester(fixture);
    tester.addInput(makeDataSet(schema, 0, 2, 10).toIndirect());
    tester.addInput(makeDataSet(schema, 1, 2, 10).toIndirect());
    tester.addOutput(makeDataSet(schema, 0, 1, 10));
    tester.addOutput(makeDataSet(schema, 10, 1, 10));
    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