@Override public int getValueCapacity() { final int offsetValueCapacity = Math.max(getOffsetBufferValueCapacity() - 1, 0); if (vector == DEFAULT_DATA_VECTOR) { return offsetValueCapacity; } return Math.min(vector.getValueCapacity(), offsetValueCapacity); }
@Override public int getValueCapacity() { if (vector == ZeroVector.INSTANCE) { return 0; } return Math.min(vector.getValueCapacity() / listSize, getValidityBufferValueCapacity()); }
@Override public int getValueCapacity() { if (size() == 0) { return 0; } return getChildren().stream() .mapToInt(child -> child.getValueCapacity()) .min() .getAsInt(); }
/** * Pre-Allocate the accumulator vectors that will be used to deserialize spilled * accumulators. These vectors are constructed keeping the target accumulator type * in mind. For example SUM(INT) will accumulate into a BIGINT vector and the latter * one is spilled so the vectors for deserialization should be preallocated * considering the type. The target type information is already available here * since {@link VectorizedHashAggOperator} has materialized the aggregate * expressions. * @param postSpillAccumulatorVectorTypes accumulator vector types * @param valueCount value count for the vector */ private void initPostSpillAccumulatorVectors(final List<Field> postSpillAccumulatorVectorTypes, final int valueCount, final AutoCloseables.RollbackCloseable rollbackCloseable) { int count = 0; for (Field field : postSpillAccumulatorVectorTypes) { FieldVector vector = TypeHelper.getNewVector(field, allocator); /* we have aggregation on INT, BIGINT, FLOAT, FLOAT4 and DECIMAL types of * columns which are all fixed width. */ Preconditions.checkArgument(vector instanceof BaseFixedWidthVector, "Error: detected invalid accumulator vector type"); rollbackCloseable.add(vector); ((BaseFixedWidthVector) vector).allocateNew(valueCount); Preconditions.checkArgument(vector.getValueCapacity() >= valueCount, "Error: failed to correctly pre-allocate accumulator vector in extra partition"); postSpillAccumulatorVectors[count] = vector; count++; } }