use of org.apache.drill.exec.vector.accessor.ColumnAccessors.VarCharColumnWriter in project drill by apache.
the class TestVariableWidthWriter method testRestartRow.
@Test
public void testRestartRow() {
try (VarCharVector vector = allocVector(1000)) {
TestIndex index = new TestIndex();
VarCharColumnWriter writer = makeWriter(vector, index);
writer.startWrite();
// Write rows, rewriting every other row.
String base = "sample-value";
writer.startRow();
index.index = 0;
for (int i = 0; i < 50; i++) {
writer.setString(base + i);
if (i % 2 == 0) {
writer.saveRow();
writer.startRow();
index.index++;
} else {
writer.restartRow();
}
}
writer.endWrite();
for (int i = 0; i < 25; i++) {
assertEquals(base + (2 * i), stringAt(vector, i));
}
}
}
Aggregations