@Override public void writeField(Object pojo, int outboundIndex) throws IllegalArgumentException, IllegalAccessException { Double o = (Double) field.get(pojo); if (o != null) { vector.setSafe(outboundIndex, o); } }
@Override public void set(ValueVector v, int index) { if(obj != null){ ((Float8Vector) v).setSafe(index, obj); } }
public void populate(final int count){ for (int i = 0; i < count; i++) { if(value != null) { ((Float8Vector) vector).setSafe(i, value); } } vector.setValueCount(count); }
@Override protected void readField(long recordsToReadInThisPass) { recordsReadInThisIteration = Math.min(pageReader.currentPageCount - pageReader.valuesRead, recordsToReadInThisPass - valuesReadInCurrentPass); for (int i = 0; i < recordsReadInThisIteration; i++){ valueVec.setSafe(valuesReadInCurrentPass + i, pageReader.dictionaryValueReader.readDouble()); } } }
@Override public void setSafeValue(ObjectInspector oi, Object hiveFieldValue, ValueVector outputVV, int outputIndex) { final double value = (double) ((DoubleObjectInspector)oi).getPrimitiveJavaObject(hiveFieldValue); ((Float8Vector) outputVV).setSafe(outputIndex, value); } }
@Override protected void readField(long recordsToReadInThisPass) { if (usingDictionary) { for (int i = 0; i < recordsToReadInThisPass; i++){ valueVec.setSafe(valuesReadInCurrentPass + i, pageReader.dictionaryValueReader.readDouble()); } } else { for (int i = 0; i < recordsToReadInThisPass; i++){ valueVec.setSafe(valuesReadInCurrentPass + i, pageReader.valueReader.readDouble()); } } } }
public void write(Float8Holder h) { vector.setSafe(idx(), h); vector.setValueCount(idx()+1); }
private void populateDouble(Float8Vector vector, Double[] data) { vector.allocateNew(); Random r = new Random(); for(int i =0; i < data.length; i++){ Double val = data[i]; if(val != null){ vector.setSafe(i, val); } else { vector.setSafe(i, 0, r.nextDouble()); } } vector.setValueCount(data.length); }
public void write(NullableFloat8Holder h) { vector.setSafe(idx(), h); vector.setValueCount(idx()+1); }
public void writeFloat8(double value) { vector.setSafe(idx(), 1, value); vector.setValueCount(idx()+1); }
/** * * @param allocator * @param name * @param data * @return */ public static Float8Vector vectorFor(BufferAllocator allocator,String name,double[] data) { Float8Vector float8Vector = new Float8Vector(name,allocator); float8Vector.allocateNew(data.length); for(int i = 0; i < data.length; i++) { float8Vector.setSafe(i,data[i]); } float8Vector.setValueCount(data.length); return float8Vector; }
private static VectorContainer buildDoubleGlobalDictionary(List<Dictionary> dictionaries, VectorContainer existingDict, ColumnDescriptor columnDescriptor, BufferAllocator bufferAllocator) { final Field field = new Field(SchemaPath.getCompoundPath(columnDescriptor.getPath()).getAsUnescapedPath(), true, new ArrowType.FloatingPoint(FloatingPointPrecision.DOUBLE), null); final VectorContainer input = new VectorContainer(bufferAllocator); final Float8Vector doubleVector = input.addOrGet(field); doubleVector.allocateNew(); SortedSet<Double> values = Sets.newTreeSet(); for (Dictionary dictionary : dictionaries) { for (int i = 0; i <= dictionary.getMaxId(); ++i) { values.add(dictionary.decodeToDouble(i)); } } if (existingDict != null) { final Float8Vector existingDictValues = existingDict.getValueAccessorById(Float8Vector.class, 0).getValueVector(); for (int i = 0; i < existingDict.getRecordCount(); ++i) { values.add(existingDictValues.get(i)); } } final Iterator<Double> iter = values.iterator(); int recordCount = 0; while (iter.hasNext()) { doubleVector.setSafe(recordCount++, iter.next()); } doubleVector.setValueCount(recordCount); input.setRecordCount(recordCount); input.buildSchema(BatchSchema.SelectionVectorMode.NONE); return input; }
@Override public int next(int records) { if (position == fixKeyValues1.length) { return 0; } records = Math.min(records, fixKeyValues1.length - position); container.allocateNew(); for (int i = 0; i < records; i++) { final int absoluteRecordIndex = position + i; fixkey1.setSafe(i, fixKeyValues1[absoluteRecordIndex]); fixkey2.setSafe(i, fixKeyValues2[absoluteRecordIndex]); byte[] valueBytes = varKeyValues1[absoluteRecordIndex].getBytes(); varkey1.setSafe(i, valueBytes, 0, valueBytes.length); m1.setSafe(i, measure1[absoluteRecordIndex]); m2.setSafe(i, measure2[absoluteRecordIndex]); m3.setSafe(i, measure3[absoluteRecordIndex]); m4.setSafe(i, measure4[absoluteRecordIndex]); } container.setAllCount(records); position += records; return records; }
Double value = pv.getDoubleValue(); if(value != null){ float8Vector.setSafe(index, value);
final Float8Vector doubleVector = dict3.addOrGet(field3); doubleVector.allocateNew(); doubleVector.setSafe(0, 100.1); doubleVector.setSafe(1, 200.2); doubleVector.setSafe(2, 300.3); doubleVector.setSafe(3, 400.4); doubleVector.setSafe(4, 500.5); doubleVector.setValueCount(5); dict3.setRecordCount(5);
switch (type.getMode()) { case REQUIRED: ((Float8Vector) vector).setSafe(index, (Float8Holder) holder); return; case OPTIONAL: if (holder instanceof NullableFloat8Holder) { if (((NullableFloat8Holder) holder).isSet == 1) { ((Float8Vector) vector).setSafe(index, (NullableFloat8Holder) holder); } else { ((Float8Vector) vector).isSafe(index); ((Float8Vector) vector).setSafe(index, (Float8Holder) holder);