/** * Get the element at the given index from the vector. * * @param index position of element * @return element at given index */ public long get(int index) throws IllegalStateException { if (isSet(index) == 0) { throw new IllegalStateException("Value at index is null"); } return valueBuffer.getLong(index * TYPE_WIDTH); }
/** * Same as {@link #get(int)}. * * @param index position of element * @return element at given index */ public Long getObject(int index) { if (isSet(index) == 0) { return null; } else { return valueBuffer.getLong(index * TYPE_WIDTH); } }
/** * Get the element at the given index from the vector and * sets the state in holder. If element at given index * is null, holder.isSet will be zero. * * @param index position of element */ public void get(int index, NullableBigIntHolder holder) { if (isSet(index) == 0) { holder.isSet = 0; return; } holder.isSet = 1; holder.value = valueBuffer.getLong(index * TYPE_WIDTH); }
/** * Copy a cell value from a particular index in source vector to a particular * position in this vector. * * @param fromIndex position to copy from in source vector * @param thisIndex position to copy to in this vector * @param from source vector */ public void copyFrom(int fromIndex, int thisIndex, BigIntVector from) { BitVectorHelper.setValidityBit(validityBuffer, thisIndex, from.isSet(fromIndex)); final long value = from.valueBuffer.getLong(fromIndex * TYPE_WIDTH); valueBuffer.setLong(thisIndex * TYPE_WIDTH, value); }
case BIGINT : holder = new NullableBigIntHolder(); ((NullableBigIntHolder)holder).isSet = ((BigIntVector) vector).isSet(index); if (((NullableBigIntHolder)holder).isSet == 1) { ((NullableBigIntHolder)holder).value = ((BigIntVector) vector).get(index);