@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 int value = (int) 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, (int) input[inputIdx]); } } else { final boolean isNull[] = inputVector.isNull; for (int i = 0; i < count; i++, inputIdx++, outputIdx++) { if (!isNull[inputIdx]) { outputVector.set(outputIdx, (int) input[inputIdx]); } } } } }
private static Pair<IntVector, ResultVerifier> testIntVector(final int startIndexInCurrentOutput, final int startIndexInJob) { IntVector colIntV = new IntVector("colInt", allocator); colIntV.allocateNew(5); colIntV.set(0, 20); colIntV.set(1, 50); colIntV.set(2, -2000); colIntV.set(3, 327345); colIntV.setNull(4); ResultVerifier verifier = new ResultVerifier() { @Override public void verify(DataPOJO output) { int index = startIndexInCurrentOutput; assertEquals(20, ((Integer)output.extractValue("colInt", 0)).intValue()); assertEquals(50, ((Integer)output.extractValue("colInt", 1)).intValue()); assertEquals(-2000, ((Integer)output.extractValue("colInt", 2)).intValue()); assertEquals(327345, ((Integer)output.extractValue("colInt", 3)).intValue()); assertNull(output.extractValue("colInt", 4)); } }; return Pair.of(colIntV, verifier); }
NullableStructWriter mapWriter = mapVector.getWriter(); for (int i = 0; i < records; i++) { intVector.set(i, intBaseValue + i); float8Vector.set(i, doubleBaseValue + i);
/** * Same as {@link #set(int, IntHolder)} 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, IntHolder holder) { handleSafe(index); set(index, holder); }
/** * Same as {@link #set(int, int)} 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, int value) { handleSafe(index); set(index, value); }
/** * Same as {@link #set(int, NullableIntHolder)} 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, NullableIntHolder holder) throws IllegalArgumentException { handleSafe(index); set(index, holder); }
/** * Same as {@link #set(int, int, int)} 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, int value) { handleSafe(index); set(index, isSet, value); }
/** * 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, int value) { if (isSet > 0) { set(index, value); } else { BitVectorHelper.setValidityBit(validityBuffer, index, 0); } }
IntVector intVector = (IntVector) fieldVector; int set = TypeConversion.getInstance().convertInt(value); intVector.set(row, set); } else if (fieldVector instanceof UInt4Vector) { UInt4Vector uInt4Vector = (UInt4Vector) fieldVector;