use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class VectorUDAFVarPopTimestamp method aggregateInput.
@Override
public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) throws HiveException {
inputExpression.evaluate(batch);
TimestampColumnVector inputColVector = (TimestampColumnVector) batch.cols[this.inputExpression.getOutputColumn()];
int batchSize = batch.size;
if (batchSize == 0) {
return;
}
Aggregation myagg = (Aggregation) agg;
if (inputColVector.isRepeating) {
if (inputColVector.noNulls) {
iterateRepeatingNoNulls(myagg, inputColVector.getDouble(0), batchSize);
}
} else if (!batch.selectedInUse && inputColVector.noNulls) {
iterateNoSelectionNoNulls(myagg, inputColVector, batchSize);
} else if (!batch.selectedInUse) {
iterateNoSelectionHasNulls(myagg, inputColVector, batchSize, inputColVector.isNull);
} else if (inputColVector.noNulls) {
iterateSelectionNoNulls(myagg, inputColVector, batchSize, batch.selected);
} else {
iterateSelectionHasNulls(myagg, inputColVector, batchSize, inputColVector.isNull, batch.selected);
}
}
use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class VectorUDAFVarSampTimestamp method aggregateInput.
@Override
public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) throws HiveException {
inputExpression.evaluate(batch);
TimestampColumnVector inputColVector = (TimestampColumnVector) batch.cols[this.inputExpression.getOutputColumn()];
int batchSize = batch.size;
if (batchSize == 0) {
return;
}
Aggregation myagg = (Aggregation) agg;
if (inputColVector.isRepeating) {
if (inputColVector.noNulls) {
iterateRepeatingNoNulls(myagg, inputColVector.getDouble(0), batchSize);
}
} else if (!batch.selectedInUse && inputColVector.noNulls) {
iterateNoSelectionNoNulls(myagg, inputColVector, batchSize);
} else if (!batch.selectedInUse) {
iterateNoSelectionHasNulls(myagg, inputColVector, batchSize, inputColVector.isNull);
} else if (inputColVector.noNulls) {
iterateSelectionNoNulls(myagg, inputColVector, batchSize, batch.selected);
} else {
iterateSelectionHasNulls(myagg, inputColVector, batchSize, inputColVector.isNull, batch.selected);
}
}
use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class VectorUDAFAvgTimestamp method aggregateInput.
@Override
public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) throws HiveException {
inputExpression.evaluate(batch);
TimestampColumnVector inputColVector = (TimestampColumnVector) batch.cols[this.inputExpression.getOutputColumn()];
int batchSize = batch.size;
if (batchSize == 0) {
return;
}
Aggregation myagg = (Aggregation) agg;
if (inputColVector.isRepeating) {
if (inputColVector.noNulls) {
if (myagg.isNull) {
myagg.isNull = false;
myagg.sum = 0;
myagg.count = 0;
}
myagg.sum += inputColVector.getDouble(0) * batchSize;
myagg.count += batchSize;
}
return;
}
if (!batch.selectedInUse && inputColVector.noNulls) {
iterateNoSelectionNoNulls(myagg, inputColVector, batchSize);
} else if (!batch.selectedInUse) {
iterateNoSelectionHasNulls(myagg, inputColVector, batchSize, inputColVector.isNull);
} else if (inputColVector.noNulls) {
iterateSelectionNoNulls(myagg, inputColVector, batchSize, batch.selected);
} else {
iterateSelectionHasNulls(myagg, inputColVector, batchSize, inputColVector.isNull, batch.selected);
}
}
use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class VectorUDAFStdSampTimestamp method aggregateInputSelection.
@Override
public void aggregateInputSelection(VectorAggregationBufferRow[] aggregationBufferSets, int aggregateIndex, VectorizedRowBatch batch) throws HiveException {
inputExpression.evaluate(batch);
TimestampColumnVector inputColVector = (TimestampColumnVector) batch.cols[this.inputExpression.getOutputColumn()];
int batchSize = batch.size;
if (batchSize == 0) {
return;
}
if (inputColVector.isRepeating) {
if (inputColVector.noNulls || !inputColVector.isNull[0]) {
iterateRepeatingNoNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, inputColVector.getDouble(0), batchSize);
}
} else if (!batch.selectedInUse && inputColVector.noNulls) {
iterateNoSelectionNoNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, inputColVector, batchSize);
} else if (!batch.selectedInUse) {
iterateNoSelectionHasNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, inputColVector, batchSize, inputColVector.isNull);
} else if (inputColVector.noNulls) {
iterateSelectionNoNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, inputColVector, batchSize, batch.selected);
} else {
iterateSelectionHasNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, inputColVector, batchSize, inputColVector.isNull, batch.selected);
}
}
use of org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector in project hive by apache.
the class ColumnVectorGenUtil method generateTimestampColumnVector.
public static TimestampColumnVector generateTimestampColumnVector(boolean nulls, boolean repeating, int size, Random rand, Timestamp[] timestampValues) {
TimestampColumnVector tcv = new TimestampColumnVector(size);
tcv.noNulls = !nulls;
tcv.isRepeating = repeating;
Timestamp repeatingTimestamp = RandomTypeUtil.getRandTimestamp(rand);
int nullFrequency = generateNullFrequency(rand);
for (int i = 0; i < size; i++) {
if (nulls && (repeating || i % nullFrequency == 0)) {
tcv.isNull[i] = true;
tcv.setNullValue(i);
timestampValues[i] = null;
} else {
tcv.isNull[i] = false;
if (!repeating) {
Timestamp randomTimestamp = RandomTypeUtil.getRandTimestamp(rand);
tcv.set(i, randomTimestamp);
timestampValues[i] = randomTimestamp;
} else {
tcv.set(i, repeatingTimestamp);
timestampValues[i] = repeatingTimestamp;
}
}
}
return tcv;
}
Aggregations