@Override public void copy(int inputIdx, int count, int outputIdx) { final double[] 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 double value = input[0]; for (int i = 0; i < count; i++, outputIdx++) { outputVector.set(outputIdx, value); } // We can't rely noNulls flag due to the bug/hive shenanigans here (they set the noNulls flag wrong): // https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/io/orc/RecordReaderImpl.java#L656 // } 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<Float8Vector, ResultVerifier> testFloat8Vector(final int startIndexInCurrentOutput, final int startIndexInJob) { Float8Vector colFloat8V = new Float8Vector("colFloat8", allocator); colFloat8V.allocateNew(5); colFloat8V.set(0, 20.2345234d); colFloat8V.set(1, 503453.023d); colFloat8V.set(2, -238423.3453453d); colFloat8V.set(3, 3273452.345324563245d); colFloat8V.setNull(4); ResultVerifier verifier = new ResultVerifier() { @Override public void verify(DataPOJO output) { int index = startIndexInCurrentOutput; assertEquals(20.2345234d, ((Double)output.extractValue("colFloat8", index++)).doubleValue(), 0.01f); assertEquals(503453.023d, ((Double)output.extractValue("colFloat8", index++)).doubleValue(), 0.01f); assertEquals(-238423.3453453d, ((Double)output.extractValue("colFloat8", index++)).doubleValue(), 0.01f); assertEquals(3273452.345324563245d, ((Double)output.extractValue("colFloat8", index++)).doubleValue(), 0.01f); assertNull(output.extractValue("colFloat8", 4)); } }; return Pair.of(colFloat8V, verifier); }
for (int i = 0; i < records; i++) { intVector.set(i, intBaseValue + i); float8Vector.set(i, doubleBaseValue + i);
/** * Same as {@link #set(int, NullableFloat8Holder)} 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, NullableFloat8Holder holder) throws IllegalArgumentException { handleSafe(index); set(index, holder); }
/** * Same as {@link #set(int, double)} 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, double value) { handleSafe(index); set(index, value); }
/** * Same as {@link #set(int, Float8Holder)} 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, Float8Holder holder) { handleSafe(index); set(index, holder); }
/** * Same as {@link #set(int, int, double)} 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, double 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, double value) { if (isSet > 0) { set(index, value); } else { BitVectorHelper.setValidityBit(validityBuffer, index, 0); } }
double set3 = TypeConversion.getInstance().convertDouble(value); Float8Vector float8Vector = (Float8Vector) fieldVector; float8Vector.set(row, set3); break; case Long: