use of org.apache.drill.test.rowSet.RowSet.SingleRowSet in project drill by axbaretto.
the class TestBatchValidator method testRepeatedBadArrayOffset.
@Test
public void testRepeatedBadArrayOffset() {
BatchSchema schema = new SchemaBuilder().add("a", MinorType.VARCHAR, DataMode.REPEATED).build();
SingleRowSet batch = fixture.rowSetBuilder(schema).addRow((Object) strArray()).addRow((Object) strArray("fred", "barney", "wilma")).addRow((Object) strArray("dino")).build();
VectorAccessible va = batch.vectorAccessible();
ValueVector v = va.iterator().next().getValueVector();
RepeatedVarCharVector vc = (RepeatedVarCharVector) v;
UInt4Vector ov = vc.getOffsetVector();
ov.getMutator().set(3, 1);
BatchValidator validator = new BatchValidator(batch.vectorAccessible(), true);
validator.validate();
List<String> errors = validator.errors();
assertEquals(1, errors.size());
assertTrue(errors.get(0).contains("Decreasing offsets"));
batch.clear();
}
use of org.apache.drill.test.rowSet.RowSet.SingleRowSet 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();
}
use of org.apache.drill.test.rowSet.RowSet.SingleRowSet in project drill by axbaretto.
the class TestSorter method testMapKey.
@Test
@Ignore("DRILL-5384")
public void testMapKey() throws Exception {
BatchSchema schema = new SchemaBuilder().addMap("map").add("key", MinorType.INT).add("value", MinorType.VARCHAR).resumeSchema().build();
SingleRowSet input = fixture.rowSetBuilder(schema).addRow(3, "third").addRow(1, "first").addRow(2, "second").withSv2().build();
SingleRowSet output = fixture.rowSetBuilder(schema).addRow(1, "first").addRow(2, "second").addRow(3, "third").build();
Sort popConfig = makeSortConfig("map.key", Ordering.ORDER_ASC, Ordering.NULLS_LAST);
runSorterTest(popConfig, input, output);
}
use of org.apache.drill.test.rowSet.RowSet.SingleRowSet in project drill by axbaretto.
the class TestSorter method testTwoRows.
// Paranoia: sort with two rows.
@Test
public void testTwoRows() throws Exception {
BatchSchema schema = SortTestUtilities.nonNullSchema();
SingleRowSet rowSet = new RowSetBuilder(fixture.allocator(), schema).addRow(1, "1").addRow(0, "0").withSv2().build();
SingleRowSet expected = new RowSetBuilder(fixture.allocator(), schema).addRow(0, "0").addRow(1, "1").build();
runSorterTest(rowSet, expected);
}
use of org.apache.drill.test.rowSet.RowSet.SingleRowSet in project drill by axbaretto.
the class TestSorter method testSingleRow.
// Sanity test: single row
@Test
public void testSingleRow() throws Exception {
BatchSchema schema = SortTestUtilities.nonNullSchema();
SingleRowSet rowSet = new RowSetBuilder(fixture.allocator(), schema).addRow(0, "0").withSv2().build();
SingleRowSet expected = new RowSetBuilder(fixture.allocator(), schema).addRow(0, "0").build();
runSorterTest(rowSet, expected);
}
Aggregations