public void allocate(){ vector.allocateNew(); }
@Override public void allocate() { vector.allocateNew(); }
public void allocate(){ vector.allocateNew(); }
static BigDecimal[] populate16ByteValuesWithoutNull(DecimalVector vector, int size){ vector.allocateNew(); BigDecimal values[] = new BigDecimal[size]; for(int i =0; i < values.length; i++){ values[i] = new BigDecimal(RAND.nextLong()); vector.setSafe(i, values[i]); } vector.setValueCount(values.length); return values; }
static BigDecimal[] populate16ByteValues(DecimalVector vector, int size){ vector.allocateNew(); BigDecimal values[] = new BigDecimal[size]; for(int i =0; i < values.length; i++){ if (RAND.nextBoolean()) { values[i] = new BigDecimal(RAND.nextLong()); vector.setSafe(i, values[i]); } } vector.setValueCount(values.length); return values; }
public void loadData(SerializedField metadata, ArrowBuf buffer) { /* clear the current buffers (if any) */ vector.clear(); /* get the metadata children */ final SerializedField bitsField = metadata.getChild(0); final SerializedField valuesField = metadata.getChild(1); final int valuesLength = buffer.capacity(); vector.allocateNew(metadata.getValueCount()); /* set inner validity buffer */ setValidityBuffer(bitsField); /* load inner value buffer */ vector.valueBuffer.close(); loadDataBuffer(valuesField, buffer.slice(0, valuesLength)); }
private static Pair<DecimalVector, ResultVerifier> testDecimalVector(final int startIndexInCurrentOutput, final int startIndexInJob) { DecimalVector colDecimalV = new DecimalVector("colDecimal", allocator, 10, 10); colDecimalV.allocateNew(5); DecimalUtility.writeBigDecimalToArrowBuf(new BigDecimal(25.03).setScale(5, RoundingMode.HALF_UP), tempBuf, 0); colDecimalV.set(0, tempBuf); DecimalUtility.writeBigDecimalToArrowBuf(new BigDecimal(2524324.034534), tempBuf, 0); colDecimalV.set(1, tempBuf); colDecimalV.setNull(2); DecimalUtility.writeBigDecimalToArrowBuf(new BigDecimal(2523423423424234243234.235), tempBuf, 0); colDecimalV.set(3, tempBuf); DecimalUtility.writeBigDecimalToArrowBuf(new BigDecimal(2523423423424234243234.23524324234234), tempBuf, 0); colDecimalV.set(4, tempBuf); ResultVerifier verifier = new ResultVerifier() { @Override public void verify(DataPOJO output) { int index = startIndexInCurrentOutput; assertEquals(2.503E-4, ((Double)output.extractValue("colDecimal", index++)).doubleValue(), 0.001f); assertEquals(2.524324034534E23, ((Double)output.extractValue("colDecimal", index++)).doubleValue(), 0.001f); assertNull(output.extractValue("colDecimal", index++)); assertEquals(2.523423423424234E11, ((Double)output.extractValue("colDecimal", index++)).doubleValue(), 0.001f); assertEquals(2.523423423424234E11, ((Double)output.extractValue("colDecimal", index++)).doubleValue(), 0.001f); } }; return Pair.of(colDecimalV, verifier); }
) { in.allocateNew(count); ArrowBuf tempBuf = allocator.buffer(1024);
try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE)) { DecimalVector decimalVector = new DecimalVector("decimal", allocator, 38, 9); decimalVector.allocateNew(8);