use of org.apache.drill.exec.vector.accessor.ColumnAccessors.IntColumnWriter in project drill by apache.
the class TestFixedWidthWriter method testWrite.
/**
* Basic test to write a contiguous set of values, enough to cause
* the vector to double in size twice, then read back the values.
*/
@Test
public void testWrite() {
try (IntVector vector = allocVector(1000)) {
TestIndex index = new TestIndex();
IntColumnWriter writer = makeWriter(vector, index);
writer.startWrite();
// Write integers.
// Write enough that the vector is resized.
long origAddr = vector.getBuffer().addr();
for (int i = 0; i < 3000; i++) {
index.index = i;
writer.setInt(i * 10);
}
writer.endWrite();
// Should have been reallocated.
assertNotEquals(origAddr, vector.getBuffer().addr());
for (int i = 0; i < 3000; i++) {
assertEquals(i * 10, vector.getAccessor().get(i));
}
}
}
Aggregations