Search in sources :

Example 6 with Decimal64ColumnVector

use of org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector in project hive by apache.

the class VectorUDAFSumDecimal64ToDecimal method aggregateInput.

@Override
public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) throws HiveException {
    inputExpression.evaluate(batch);
    Decimal64ColumnVector inputVector = (Decimal64ColumnVector) batch.cols[this.inputExpression.getOutputColumnNum()];
    int batchSize = batch.size;
    if (batchSize == 0) {
        return;
    }
    Aggregation myagg = (Aggregation) agg;
    long[] vector = inputVector.vector;
    if (inputVector.isRepeating) {
        if (inputVector.noNulls || !inputVector.isNull[0]) {
            if (myagg.isNull) {
                myagg.isNull = false;
                myagg.sum = 0;
            }
            myagg.sumValueNoCheck(vector[0] * batchSize);
        }
        return;
    }
    if (!batch.selectedInUse && inputVector.noNulls) {
        iterateNoSelectionNoNulls(myagg, vector, batchSize);
    } else if (!batch.selectedInUse) {
        iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull);
    } else if (inputVector.noNulls) {
        iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected);
    } else {
        iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected);
    }
}
Also used : Decimal64ColumnVector(org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector)

Example 7 with Decimal64ColumnVector

use of org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector in project hive by apache.

the class VectorUDAFSumDecimal64ToDecimal method aggregateInputSelection.

@Override
public void aggregateInputSelection(VectorAggregationBufferRow[] aggregationBufferSets, int aggregateIndex, VectorizedRowBatch batch) throws HiveException {
    int batchSize = batch.size;
    if (batchSize == 0) {
        return;
    }
    inputExpression.evaluate(batch);
    Decimal64ColumnVector inputVector = (Decimal64ColumnVector) batch.cols[this.inputExpression.getOutputColumnNum()];
    long[] vector = inputVector.vector;
    if (inputVector.noNulls) {
        if (inputVector.isRepeating) {
            iterateNoNullsRepeatingWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector[0], batchSize);
        } else {
            if (batch.selectedInUse) {
                iterateNoNullsSelectionWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector, batch.selected, batchSize);
            } else {
                iterateNoNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector, batchSize);
            }
        }
    } else {
        if (inputVector.isRepeating) {
            iterateHasNullsRepeatingWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector[0], batchSize, inputVector.isNull);
        } else {
            if (batch.selectedInUse) {
                iterateHasNullsSelectionWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected, inputVector.isNull);
            } else {
                iterateHasNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull);
            }
        }
    }
}
Also used : Decimal64ColumnVector(org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector)

Example 8 with Decimal64ColumnVector

use of org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector in project hive by apache.

the class VectorUDAFSumDecimal64 method aggregateInput.

@Override
public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) throws HiveException {
    inputExpression.evaluate(batch);
    Decimal64ColumnVector inputVector = (Decimal64ColumnVector) batch.cols[this.inputExpression.getOutputColumnNum()];
    int batchSize = batch.size;
    if (batchSize == 0) {
        return;
    }
    Aggregation myagg = (Aggregation) agg;
    long[] vector = inputVector.vector;
    if (inputVector.isRepeating) {
        if (inputVector.noNulls || !inputVector.isNull[0]) {
            if (myagg.isNull) {
                myagg.isNull = false;
                myagg.sum = 0;
            }
            myagg.sumValueNoNullCheck(vector[0] * batchSize);
        }
        return;
    }
    if (!batch.selectedInUse && inputVector.noNulls) {
        iterateNoSelectionNoNulls(myagg, vector, batchSize);
    } else if (!batch.selectedInUse) {
        iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull);
    } else if (inputVector.noNulls) {
        iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected);
    } else {
        iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected);
    }
}
Also used : Decimal64ColumnVector(org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector)

Example 9 with Decimal64ColumnVector

use of org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector in project hive by apache.

the class VectorUDAFSumDecimal64 method aggregateInputSelection.

@Override
public void aggregateInputSelection(VectorAggregationBufferRow[] aggregationBufferSets, int aggregateIndex, VectorizedRowBatch batch) throws HiveException {
    int batchSize = batch.size;
    if (batchSize == 0) {
        return;
    }
    inputExpression.evaluate(batch);
    Decimal64ColumnVector inputVector = (Decimal64ColumnVector) batch.cols[this.inputExpression.getOutputColumnNum()];
    long[] vector = inputVector.vector;
    if (inputVector.noNulls) {
        if (inputVector.isRepeating) {
            iterateNoNullsRepeatingWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector[0], batchSize);
        } else {
            if (batch.selectedInUse) {
                iterateNoNullsSelectionWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector, batch.selected, batchSize);
            } else {
                iterateNoNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector, batchSize);
            }
        }
    } else {
        if (inputVector.isRepeating) {
            iterateHasNullsRepeatingWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector[0], batchSize, inputVector.isNull);
        } else {
            if (batch.selectedInUse) {
                iterateHasNullsSelectionWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected, inputVector.isNull);
            } else {
                iterateHasNullsWithAggregationSelection(aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull);
            }
        }
    }
}
Also used : Decimal64ColumnVector(org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector)

Aggregations

Decimal64ColumnVector (org.apache.hadoop.hive.ql.exec.vector.Decimal64ColumnVector)9 DecimalColumnVector (org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector)2 HiveDecimalWritable (org.apache.hadoop.hive.serde2.io.HiveDecimalWritable)2 ColumnVector (org.apache.hadoop.hive.ql.exec.vector.ColumnVector)1 LongColumnVector (org.apache.hadoop.hive.ql.exec.vector.LongColumnVector)1 DecimalTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo)1