org.apache.hadoop.hive.ql.exec
Class GroupByOperator

java.lang.Object
  extended by org.apache.hadoop.hive.ql.exec.Operator<groupByDesc>
      extended by org.apache.hadoop.hive.ql.exec.GroupByOperator
All Implemented Interfaces:
Serializable, Node

public class GroupByOperator
extends Operator<groupByDesc>
implements Serializable

GroupBy operator implementation.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hive.ql.exec.Operator
Operator.OperatorFunc, Operator.State
 
Field Summary
protected  boolean[] aggregationIsDistinct
           
protected  ExprNodeEvaluator[][] aggregationParameterFields
           
protected  UDAFEvaluator[] aggregations
           
protected  Method[] aggregationsAggregateMethods
           
protected  Method[] aggregationsEvaluateMethods
           
protected  Object[][] aggregationsParametersLastInvoke
           
protected  ArrayList<Object> currentKeys
           
protected  HashMap<ArrayList<Object>,UDAFEvaluator[]> hashAggregations
           
protected  ExprNodeEvaluator[] keyFields
           
protected  ArrayList<ObjectInspector> objectInspectors
           
protected  ObjectInspector outputObjectInspector
           
 
Fields inherited from class org.apache.hadoop.hive.ql.exec.Operator
alias, childOperators, conf, done, gWork, id, joinAlias, out, parentOperators, reporter, statsMap
 
Constructor Summary
GroupByOperator()
           
 
Method Summary
 void close(boolean abort)
          We need to forward all the aggregations to children.
protected  void forward(ArrayList<Object> keys, UDAFEvaluator[] aggs)
          Forward a record of keys and aggregation results.
 List<String> genColLists(HashMap<Operator<? extends Serializable>,OpParseContext> opParseCtx)
           
 String getName()
          Implements the getName function for the Node Interface.
 void initialize(org.apache.hadoop.conf.Configuration hconf, org.apache.hadoop.mapred.Reporter reporter)
           
protected  UDAFEvaluator[] newAggregations()
           
 void process(Object row, ObjectInspector rowInspector)
           
protected  void updateAggregations(UDAFEvaluator[] aggs, Object row, ObjectInspector rowInspector, boolean hashAggr, boolean newEntry, Object[][] lastInvoke)
           
 
Methods inherited from class org.apache.hadoop.hive.ql.exec.Operator
dump, endGroup, forward, getChildOperators, getChildren, getConf, getDone, getParentOperators, getSchema, getStats, jobClose, logStats, preorderMap, resetStats, setAlias, setChildOperators, setConf, setDone, setId, setJoinAlias, setMapredWork, setOutputCollector, setParentOperators, setSchema, startGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyFields

protected transient ExprNodeEvaluator[] keyFields

aggregationParameterFields

protected transient ExprNodeEvaluator[][] aggregationParameterFields

aggregationIsDistinct

protected transient boolean[] aggregationIsDistinct

aggregationsAggregateMethods

protected transient Method[] aggregationsAggregateMethods

aggregationsEvaluateMethods

protected transient Method[] aggregationsEvaluateMethods

objectInspectors

protected transient ArrayList<ObjectInspector> objectInspectors

outputObjectInspector

protected transient ObjectInspector outputObjectInspector

currentKeys

protected transient ArrayList<Object> currentKeys

aggregations

protected transient UDAFEvaluator[] aggregations

aggregationsParametersLastInvoke

protected transient Object[][] aggregationsParametersLastInvoke

hashAggregations

protected transient HashMap<ArrayList<Object>,UDAFEvaluator[]> hashAggregations
Constructor Detail

GroupByOperator

public GroupByOperator()
Method Detail

initialize

public void initialize(org.apache.hadoop.conf.Configuration hconf,
                       org.apache.hadoop.mapred.Reporter reporter)
                throws HiveException
Overrides:
initialize in class Operator<groupByDesc>
Throws:
HiveException

newAggregations

protected UDAFEvaluator[] newAggregations()
                                   throws HiveException
Throws:
HiveException

updateAggregations

protected void updateAggregations(UDAFEvaluator[] aggs,
                                  Object row,
                                  ObjectInspector rowInspector,
                                  boolean hashAggr,
                                  boolean newEntry,
                                  Object[][] lastInvoke)
                           throws HiveException
Throws:
HiveException

process

public void process(Object row,
                    ObjectInspector rowInspector)
             throws HiveException
Specified by:
process in class Operator<groupByDesc>
Throws:
HiveException

forward

protected void forward(ArrayList<Object> keys,
                       UDAFEvaluator[] aggs)
                throws HiveException
Forward a record of keys and aggregation results.

Parameters:
keys - The keys in the record
Throws:
HiveException

close

public void close(boolean abort)
           throws HiveException
We need to forward all the aggregations to children.

Overrides:
close in class Operator<groupByDesc>
Throws:
HiveException

genColLists

public List<String> genColLists(HashMap<Operator<? extends Serializable>,OpParseContext> opParseCtx)

getName

public String getName()
Description copied from class: Operator
Implements the getName function for the Node Interface.

Specified by:
getName in interface Node
Overrides:
getName in class Operator<groupByDesc>
Returns:
the name of the operator


Copyright © 2009 The Apache Software Foundation