use of org.apache.drill.exec.vector.VectorOverflowException in project drill by axbaretto.
the class TestVectorLimits method testNullableFixedVector.
@Test
public void testNullableFixedVector() {
@SuppressWarnings("resource") NullableIntVector vector = new NullableIntVector(makeField(MinorType.INT, DataMode.OPTIONAL), fixture.allocator());
vector.allocateNew();
NullableIntVector.Mutator mutator = vector.getMutator();
for (int i = 0; i < 2 * ValueVector.MAX_ROW_COUNT; i++) {
try {
mutator.setScalar(i, i);
} catch (VectorOverflowException e) {
assertEquals(IntVector.MAX_SCALAR_COUNT, i);
break;
}
}
vector.close();
}
use of org.apache.drill.exec.vector.VectorOverflowException in project drill by axbaretto.
the class TestVectorLimits method testNullableWideVariableVector.
@Test
public void testNullableWideVariableVector() {
@SuppressWarnings("resource") NullableVarCharVector vector = new NullableVarCharVector(makeField(MinorType.VARCHAR, DataMode.OPTIONAL), fixture.allocator());
vector.allocateNew();
byte[] dummyValue = makeVarCharValue(512);
NullableVarCharVector.Mutator mutator = vector.getMutator();
int count = 0;
for (; count < 2 * ValueVector.MAX_ROW_COUNT; count++) {
try {
mutator.setScalar(count, dummyValue, 0, dummyValue.length);
} catch (VectorOverflowException e) {
break;
}
}
mutator.setValueCount(count);
assertEquals(ValueVector.MAX_BUFFER_SIZE, vector.getValuesVector().getBuffer().getActualMemoryConsumed());
assertTrue(count < ValueVector.MAX_ROW_COUNT);
vector.close();
}
use of org.apache.drill.exec.vector.VectorOverflowException in project drill by axbaretto.
the class TestVectorLimits method testNarrowVariableVector.
/**
* Test a vector directly using the vector mutator to ensure
* that the <tt>setScalar</tt> method works for the maximum
* value count.
*/
@Test
public void testNarrowVariableVector() {
@SuppressWarnings("resource") VarCharVector vector = new VarCharVector(makeField(MinorType.VARCHAR, DataMode.REQUIRED), fixture.allocator());
vector.allocateNew();
// Write small values that fit into 16 MB. We should stop writing
// when we reach the value count limit.
byte[] dummyValue = makeVarCharValue(254);
VarCharVector.Mutator mutator = vector.getMutator();
int count = 0;
for (; count < 2 * ValueVector.MAX_ROW_COUNT; count++) {
try {
mutator.setScalar(count, dummyValue, 0, dummyValue.length);
} catch (VectorOverflowException e) {
break;
}
}
// Buffer size should be at or below the maximum, with count
// at the maximum.
mutator.setValueCount(count);
assertTrue(vector.getBuffer().getActualMemoryConsumed() <= ValueVector.MAX_BUFFER_SIZE);
assertEquals(ValueVector.MAX_ROW_COUNT, count);
vector.close();
}
use of org.apache.drill.exec.vector.VectorOverflowException in project drill by axbaretto.
the class TestVectorLimits method testRepeatedFixedVectorBufferLimit.
/**
* Repeated fixed vector. Using an int vector, each column array can hold
* 256 / 4 = 64 values. We write 100. The vector becomes full when we
* exceed the 16 MB size limit.
*/
@Test
public void testRepeatedFixedVectorBufferLimit() {
@SuppressWarnings("resource") RepeatedIntVector vector = new RepeatedIntVector(makeField(MinorType.INT, DataMode.REPEATED), fixture.allocator());
vector.allocateNew();
RepeatedIntVector.Mutator mutator = vector.getMutator();
top: for (int i = 0; i < 2 * ValueVector.MAX_ROW_COUNT; i++) {
// We'll never hit the value count limit
assertTrue(mutator.startNewValueBounded(i));
for (int j = 0; j < 100; j++) {
try {
mutator.addEntry(i, i * 100 + j);
} catch (VectorOverflowException e) {
// We should have hit the buffer limit before the value limit.
assertTrue(i < ValueVector.MAX_ROW_COUNT);
mutator.setValueCount(i);
break top;
}
}
}
vector.close();
}
Aggregations