@Override public void copy(int inputIdx, int count, int outputIdx) { final long[] input = inputVector.vector; if (inputVector.isRepeating) { if (inputVector.isNull[0]) { return; // If all repeating values are null, then there is no need to write anything to vector } final long value = input[0]; for (int i = 0; i < count; i++, outputIdx++) { outputVector.set(outputIdx, value); } } else if (inputVector.noNulls) { for (int i = 0; i < count; i++, inputIdx++, outputIdx++) { outputVector.set(outputIdx, input[inputIdx]); } } else { final boolean isNull[] = inputVector.isNull; for (int i = 0; i < count; i++, inputIdx++, outputIdx++) { if (!isNull[inputIdx]) { outputVector.set(outputIdx, input[inputIdx]); } } } } }
private static Pair<BigIntVector, ResultVerifier> testBigIntVector(final int startIndexInCurrentOutput, final int startIndexInJob) { BigIntVector colBigIntV = new BigIntVector("colBigInt", allocator); colBigIntV.allocateNew(5); colBigIntV.setNull(0); colBigIntV.set(1, 50); colBigIntV.set(2, -2000); colBigIntV.set(3, 327345234234L); colBigIntV.set(4, 0); ResultVerifier verifier = new ResultVerifier() { @Override public void verify(DataPOJO output) { int index = startIndexInCurrentOutput; assertNull(output.extractValue("colBigInt", index++)); assertEquals(50, ((Integer)output.extractValue("colBigInt", index++)).intValue()); assertEquals(-2000, ((Integer)output.extractValue("colBigInt", index++)).intValue()); assertEquals(327345234234L, ((Long)output.extractValue("colBigInt", index++)).longValue()); assertEquals(0, ((Integer)output.extractValue("colBigInt", index++)).intValue()); } }; return Pair.of(colBigIntV, verifier); }
/** * Same as {@link #set(int, long)} except that it handles the * case when index is greater than or equal to existing * value capacity {@link #getValueCapacity()}. * * @param index position of element * @param value value of element */ public void setSafe(int index, long value) { handleSafe(index); set(index, value); }
/** * Same as {@link #set(int, int, long)} except that it handles the case * when index is greater than or equal to current value capacity of the * vector. * @param index position of the new value * @param isSet 0 for NULL value, 1 otherwise * @param value element value */ public void setSafe(int index, int isSet, long value) { handleSafe(index); set(index, isSet, value); }
/** * Same as {@link #set(int, NullableBigIntHolder)} except that it handles the * case when index is greater than or equal to existing * value capacity {@link #getValueCapacity()}. * * @param index position of element * @param holder nullable data holder for value of element */ public void setSafe(int index, NullableBigIntHolder holder) throws IllegalArgumentException { handleSafe(index); set(index, holder); }
/** * Same as {@link #set(int, BigIntHolder)} except that it handles the * case when index is greater than or equal to existing * value capacity {@link #getValueCapacity()}. * * @param index position of element * @param holder data holder for value of element */ public void setSafe(int index, BigIntHolder holder) { handleSafe(index); set(index, holder); }
/** * Store the given value at a particular position in the vector. isSet indicates * whether the value is NULL or not. * @param index position of the new value * @param isSet 0 for NULL value, 1 otherwise * @param value element value */ public void set(int index, int isSet, long value) { if (isSet > 0) { set(index, value); } else { BitVectorHelper.setValidityBit(validityBuffer, index, 0); } }
if (fieldVector instanceof BigIntVector) { BigIntVector largeIntVector = (BigIntVector) fieldVector; largeIntVector.set(row, TypeConversion.getInstance().convertLong(value));