use of org.apache.drill.test.rowSet.RowSet.SingleRowSet in project drill by axbaretto.
the class TestBatchValidator method testVariableCorruptLastOutOfRange.
@Test
public void testVariableCorruptLastOutOfRange() {
BatchSchema schema = new SchemaBuilder().add("a", MinorType.VARCHAR).build();
SingleRowSet batch = fixture.rowSetBuilder(schema).addRow("xx").addRow("yy").addRow("zz").build();
zapOffset(batch, 3, 100_000);
// Validator should catch the error.
BatchValidator validator = new BatchValidator(batch.vectorAccessible(), true);
validator.validate();
List<String> errors = validator.errors();
assertEquals(1, errors.size());
assertTrue(errors.get(0).contains("Invalid offset"));
batch.clear();
}
use of org.apache.drill.test.rowSet.RowSet.SingleRowSet in project drill by axbaretto.
the class TestBatchValidator method testVariableCorruptMiddleHigh.
@Test
public void testVariableCorruptMiddleHigh() {
BatchSchema schema = new SchemaBuilder().add("a", MinorType.VARCHAR).build();
SingleRowSet batch = fixture.rowSetBuilder(schema).addRow("xx").addRow("yy").addRow("zz").build();
zapOffset(batch, 1, 10);
// Validator should catch the error.
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 TestBatchValidator method testVariableCorruptMiddleLow.
@Test
public void testVariableCorruptMiddleLow() {
BatchSchema schema = new SchemaBuilder().add("a", MinorType.VARCHAR).build();
SingleRowSet batch = fixture.rowSetBuilder(schema).addRow("xx").addRow("yy").addRow("zz").build();
zapOffset(batch, 2, 1);
// Validator should catch the error.
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 TestBatchValidator method testRepeatedBadValueOffset.
@Test
public void testRepeatedBadValueOffset() {
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 rvc = (RepeatedVarCharVector) v;
VarCharVector vc = rvc.getDataVector();
UInt4Vector ov = vc.getOffsetVector();
ov.getMutator().set(4, 100_000);
BatchValidator validator = new BatchValidator(batch.vectorAccessible(), true);
validator.validate();
List<String> errors = validator.errors();
assertEquals(1, errors.size());
assertTrue(errors.get(0).contains("Invalid offset"));
batch.clear();
}
use of org.apache.drill.test.rowSet.RowSet.SingleRowSet in project drill by axbaretto.
the class TestBatchValidator method testValidVariable.
@Test
public void testValidVariable() {
BatchSchema schema = new SchemaBuilder().add("a", MinorType.VARCHAR).addNullable("b", MinorType.VARCHAR).build();
SingleRowSet batch = fixture.rowSetBuilder(schema).addRow("col1.1", "col1.2").addRow("col2.1", "col2.2").addRow("col3.1", null).addRow("col4.1", "col4.2").build();
BatchValidator validator = new BatchValidator(batch.vectorAccessible(), true);
validator.validate();
assertTrue(validator.errors().isEmpty());
batch.clear();
}
Aggregations