@Override final int getInt(int rowId) { return accessor.get(rowId); } }
@Override final int getInt(int rowId) { return accessor.get(rowId); } }
public void getFieldById(int fieldId, NullableIntHolder holder) { ((IntVector) vectors[fieldId]).get(currentIndex, holder); }
@Override public int getInt(int index) { return ac.get(index); }
public void getFieldById(int fieldId, IntHolder holder) { ((IntVector) vectors[fieldId]).get(currentIndex); }
private static int getIntFromFieldVector(int row,FieldVector fieldVector) { if(fieldVector instanceof UInt4Vector) { UInt4Vector uInt4Vector = (UInt4Vector) fieldVector; return uInt4Vector.get(row); } else if(fieldVector instanceof IntVector) { IntVector intVector = (IntVector) fieldVector; return intVector.get(row); } throw new IllegalArgumentException("Illegal vector type for int " + fieldVector.getClass().getName()); }
public void read(NullableIntHolder h){ vector.get(idx(), h); }
private WritePartition getPartition(int offset){ String[] paths = new String[partitions.size()]; for(int i = 0; i < paths.length; i++){ paths[i] = fromObj(partitions.get(i).getObject(offset)); } final Integer bucketNumberValue = bucketNumber == null ? null : bucketNumber.get(offset); return new WritePartition(paths, bucketNumberValue); }
private void decodeInt(IntVector input, IntVector output, IntVector dictionary) { if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0, svIndex = sv2.getIndex(i); i < recordsConsumedCurrentBatch; ++i) { final int id = input.get(svIndex); output.copyFromSafe(id, svIndex, dictionary); } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { int id = input.get(i); output.copyFromSafe(id, i, dictionary); } } }
private void decodeBigInt(IntVector input, BigIntVector output, BigIntVector dictionary) { if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int svIndex = sv2.getIndex(i); final int id = input.get(svIndex); output.copyFromSafe(id, svIndex, dictionary); } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int id = input.get(i); output.copyFromSafe(id, i, dictionary); } } }
private void decodeDouble(IntVector input, Float8Vector output, Float8Vector dictionary) { if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int svIndex = sv2.getIndex(i); final int id = input.get(svIndex); output.copyFromSafe(id, svIndex, dictionary); } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int id = input.get(i); output.copyFromSafe(id, i, dictionary); } } }
private void decodeFloat(IntVector input, Float4Vector output, Float4Vector dictionary) { if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int svIndex = sv2.getIndex(i); final int id = input.get(svIndex); output.copyFromSafe(id, svIndex, dictionary); } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int id = input.get(i); output.copyFromSafe(id, i, dictionary); } } }
private void decodeBinary(IntVector input, VarBinaryVector output, VarBinaryVector dictionary) { if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int svIndex = sv2.getIndex(i); final int id = input.get(svIndex); output.copyFromSafe(id, svIndex, dictionary); } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int id = input.get(i); output.copyFromSafe(id, i, dictionary); } } }
private void decodeDate(IntVector input, DateMilliVector output, IntVector dictionary) { // dates are stored as int32 in parquet dictionaries if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int svIndex = sv2.getIndex(i); if (input.isNull(svIndex)) { output.setNull(svIndex); } else { final int id = input.get(svIndex); output.setSafe(svIndex, dictionary.get(id) * (long) DateTimeConstants.MILLIS_PER_DAY); } } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { if (input.isNull(i)) { output.setNull(i); } else { int id = input.get(i); output.setSafe(i, dictionary.get(id) * (long) DateTimeConstants.MILLIS_PER_DAY); } } } }
private void decodeBoolean(IntVector input, BitVector output) { if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int svIndex = sv2.getIndex(i); if (input.isNull(svIndex)) { output.setNull(svIndex); } else { final int id = input.get(svIndex); output.setSafe(svIndex, id); } } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { if (input.isNull(i)) { output.setNull(i); } else { final int id = input.get(i); output.setSafe(i, id); } } } }
private void decodeTimestamp(IntVector input, TimeStampMilliVector output, BigIntVector dictionary) { // dates are stored as int32 in parquet dictionaries if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int svIndex = sv2.getIndex(i); if (input.isNull(svIndex)) { output.setNull(svIndex); } else { final int id = input.get(svIndex); output.setSafe(svIndex, dictionary.get(id)); } } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { if (input.isNull(i)) { output.setNull(i); } else { int id = input.get(i); output.setSafe(i, dictionary.get(id)); } } } }
public void assertIsSorted(VectorContainer container, int startIndex) { final IntVector idVector = container.addOrGet(ID); final VarCharVector valueVector = container.addOrGet(VALUE); int recordCount = container.getRecordCount(); int index = startIndex; for (int i = 0; i < recordCount; i++, index++) { int rowId = sortedRowIds.get(index); String value = values.get(rowId); assertEquals("non matching ID at row " + index, rowId, idVector.get(i)); assertEquals("non matching VALUE at row " + index, value, valueVector.getObject(i).toString()); } }
private void decodeVarChar(IntVector input, VarCharVector output, VarBinaryVector dictionary) { if (hasSv2) { final SelectionVector2 sv2 = incoming.getSelectionVector2(); for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { final int svIndex = sv2.getIndex(i); // TODO : Implement CopySafe between varchar and varbinary vectors. if (!input.isNull(svIndex)) { output.setNull(svIndex); } else { final int id = input.get(svIndex); final byte[] value = dictionary.get(id); output.setSafe(svIndex, value, 0, value.length); } } } else { for (int i = 0; i < recordsConsumedCurrentBatch; ++i) { if (input.isNull(i)) { output.setNull(i); } else { final int id = input.get(i); final byte[] value = dictionary.get(id); output.setSafe(i, value, 0, value.length); } } } }
private static VectorContainer buildIntegerGlobalDictionary(List<Dictionary> dictionaries, VectorContainer existingDict, ColumnDescriptor columnDescriptor, BufferAllocator bufferAllocator) { final Field field = new Field(SchemaPath.getCompoundPath(columnDescriptor.getPath()).getAsUnescapedPath(), true, new ArrowType.Int(32, true), null); final VectorContainer input = new VectorContainer(bufferAllocator); final IntVector intVector = input.addOrGet(field); intVector.allocateNew(); final SortedSet<Integer> values = Sets.newTreeSet(); for (Dictionary dictionary : dictionaries) { for (int i = 0; i <= dictionary.getMaxId(); ++i) { values.add(dictionary.decodeToInt(i)); } } if (existingDict != null) { final IntVector existingDictValues = existingDict.getValueAccessorById(IntVector.class, 0).getValueVector(); for (int i = 0; i < existingDict.getRecordCount(); ++i) { values.add(existingDictValues.get(i)); } } final Iterator<Integer> iter = values.iterator(); int recordCount = 0; while (iter.hasNext()) { intVector.setSafe(recordCount++, iter.next()); } intVector.setValueCount(recordCount); input.setRecordCount(recordCount); input.buildSchema(BatchSchema.SelectionVectorMode.NONE); return input; }