Search in sources :

Example 6 with AggregationBuffer

use of org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer in project hive by apache.

the class GroupByOperator method estimateRowSize.

/**
 * @return the size of each row
 */
private void estimateRowSize() throws HiveException {
    // estimate the size of each entry -
    // a datatype with unknown size (String/Struct etc. - is assumed to be 256
    // bytes for now).
    // 64 bytes is the overhead for a reference
    fixedRowSize = javaHashEntryOverHead;
    ArrayList<ExprNodeDesc> keys = conf.getKeys();
    // track of the variable length keys
    for (int pos = 0; pos < keys.size(); pos++) {
        fixedRowSize += getSize(pos, keys.get(pos).getTypeInfo());
    }
    // Go over all the aggregation classes and and get the size of the fields of
    // fixed length. Keep track of the variable length
    // fields in these aggregation classes.
    estimableAggregationEvaluators = new boolean[aggregationEvaluators.length];
    for (int i = 0; i < aggregationEvaluators.length; i++) {
        fixedRowSize += javaObjectOverHead;
        AggregationBuffer agg = aggregationEvaluators[i].getNewAggregationBuffer();
        if (GenericUDAFEvaluator.isEstimable(agg)) {
            estimableAggregationEvaluators[i] = true;
            continue;
        }
        Field[] fArr = ObjectInspectorUtils.getDeclaredNonStaticFields(agg.getClass());
        for (Field f : fArr) {
            fixedRowSize += getSize(i, f.getType(), f);
        }
    }
}
Also used : StructField(org.apache.hadoop.hive.serde2.objectinspector.StructField) Field(java.lang.reflect.Field) ExprNodeDesc(org.apache.hadoop.hive.ql.plan.ExprNodeDesc) AggregationBuffer(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer)

Aggregations

AggregationBuffer (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer)6 GenericUDAFEvaluator (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator)4 ArgDef (com.sap.hadoop.windowing.query2.definition.ArgDef)2 ArrayList (java.util.ArrayList)2 StructField (org.apache.hadoop.hive.serde2.objectinspector.StructField)2 SameList (com.sap.hadoop.ds.SameList)1 WindowingException (com.sap.hadoop.windowing.WindowingException)1 WindowFunctionInfo (com.sap.hadoop.windowing.functions2.FunctionRegistry.WindowFunctionInfo)1 WindowFunctionDef (com.sap.hadoop.windowing.query2.definition.WindowFunctionDef)1 Partition (com.sap.hadoop.windowing.runtime2.Partition)1 Field (java.lang.reflect.Field)1 List (java.util.List)1 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)1 ExprNodeDesc (org.apache.hadoop.hive.ql.plan.ExprNodeDesc)1 PTFExpressionDef (org.apache.hadoop.hive.ql.plan.ptf.PTFExpressionDef)1 AbstractAggregationBuffer (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AbstractAggregationBuffer)1 ISupportStreamingModeForWindowing (org.apache.hadoop.hive.ql.udf.generic.ISupportStreamingModeForWindowing)1 SerDeException (org.apache.hadoop.hive.serde2.SerDeException)1 ByteArrayRef (org.apache.hadoop.hive.serde2.lazy.ByteArrayRef)1 LazyBinary (org.apache.hadoop.hive.serde2.lazy.LazyBinary)1