/** * Same as {@link #set(int, SmallIntHolder)} 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, SmallIntHolder holder) { handleSafe(index); set(index, holder); }
private static Pair<SmallIntVector, ResultVerifier> testSmallIntVector(final int startIndexInCurrentOutput, final int startIndexInJob) { SmallIntVector colSmallIntV = new SmallIntVector("colSmallInt", allocator); colSmallIntV.allocateNew(5); colSmallIntV.set(0, 20); colSmallIntV.setNull(1); colSmallIntV.set(2, -2000); colSmallIntV.set(3, 32700); colSmallIntV.set(4, 0); ResultVerifier verifier = new ResultVerifier() { @Override public void verify(DataPOJO output) { int index = startIndexInCurrentOutput; assertEquals(20, ((Integer)output.extractValue("colSmallInt", 0)).intValue()); assertNull(output.extractValue("colSmallInt", 1)); assertEquals(-2000, ((Integer)output.extractValue("colSmallInt", 2)).intValue()); assertEquals(32700, ((Integer)output.extractValue("colSmallInt", 3)).intValue()); assertEquals(0, ((Integer)output.extractValue("colSmallInt", 4)).intValue()); } }; return Pair.of(colSmallIntV, verifier); }
/** * Same as {@link #set(int, NullableSmallIntHolder)} 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, NullableSmallIntHolder holder) throws IllegalArgumentException { 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, short)} 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, short value) { handleSafe(index); set(index, value); }
/** * Same as {@link #set(int, int, short)} 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, short 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, short value) { if (isSet > 0) { set(index, value); } else { BitVectorHelper.setValidityBit(validityBuffer, index, 0); } }