return null;
}
@Override
Object nextVector(Object previousVector, long batchSize) throws IOException {
DecimalColumnVector result = null;
if (previousVector == null) {
result = new DecimalColumnVector(precision, scale);
} else {
result = (DecimalColumnVector) previousVector;
}
// Save the reference for isNull in the scratch vector
boolean [] scratchIsNull = scratchScaleVector.isNull;
// Read present/isNull stream
super.nextVector(result, batchSize);
// Read value entries based on isNull entries
if (result.isRepeating) {
if (!result.isNull[0]) {
BigInteger bInt = SerializationUtils.readBigInteger(valueStream);
short scaleInData = (short) scaleStream.next();
HiveDecimal dec = HiveDecimal.create(bInt, scaleInData);
dec = HiveDecimalUtils.enforcePrecisionScale(dec, precision, scale);
result.set(0, dec);
}
} else {
// result vector has isNull values set, use the same to read scale vector.
scratchScaleVector.isNull = result.isNull;
scaleStream.nextVector(scratchScaleVector, batchSize);
for (int i = 0; i < batchSize; i++) {
if (!result.isNull[i]) {
BigInteger bInt = SerializationUtils.readBigInteger(valueStream);
short scaleInData = (short) scratchScaleVector.vector[i];
HiveDecimal dec = HiveDecimal.create(bInt, scaleInData);
dec = HiveDecimalUtils.enforcePrecisionScale(dec, precision, scale);
result.set(i, dec);
}
}
}
// Switch back the null vector.
scratchScaleVector.isNull = scratchIsNull;