fe/src/main/java/com/cloudera/impala/analysis/AggregateInfo.java
/**
   * Creates complete AggregateInfo for groupingExprs and aggExprs, including
   * aggTupleDesc and aggTupleSMap. If parameter tupleDesc != null, sets aggTupleDesc to
   * that instead of creating a new descriptor (after verifying that the passed-in
   * descriptor is correct for the given aggregation).
   * Also creates mergeAggInfo and secondPhaseDistinctAggInfo, if needed.
   * If an aggTupleDesc is created, also registers eq predicates between the
   * grouping exprs and their respective slots with 'analyzer'.
   */
Creates complete AggregateInfo for groupingExprs and aggExprs, including
aggTupleDesc and aggTupleSMap. If parameter tupleDesc != null, sets aggTupleDesc to
that instead of creating a new descriptor (after verifying that the passed-in
descriptor is correct for the given aggregation).
Also creates mergeAggInfo and secondPhaseDistinctAggInfo, if needed.
If an aggTupleDesc is created, also registers eq predicates between the
grouping exprs and their respective slots with 'analyzer'.
Creates complete AggregateInfo for groupingExprs and aggExprs including aggTupleDesc and aggTupleSMap . If parameter tupleDesc ! = null sets aggTupleDesc to that instead of creating a new descriptor ( after verifying that the passed - in descriptor is correct for the given aggregation ) . Also creates mergeAggInfo and secondPhaseDistinctAggInfo if needed . If an aggTupleDesc is created also registers eq predicates between the grouping exprs and their respective slots with ' analyzer ' .
static public AggregateInfo create(
      ArrayList<Expr> groupingExprs, ArrayList<FunctionCallExpr> aggExprs,
      TupleDescriptor tupleDesc, Analyzer analyzer)
      throws AnalysisException, InternalException, AuthorizationException {
    Preconditions.checkState(
        (groupingExprs != null && !groupingExprs.isEmpty())
        || (aggExprs != null && !aggExprs.isEmpty()));
    Expr.removeDuplicates(groupingExprs);
    Expr.removeDuplicates(aggExprs);
    AggregateInfo result = new AggregateInfo(groupingExprs, aggExprs, false);
    ArrayList<FunctionCallExpr> distinctAggExprs = Lists.newArrayList();
    if (aggExprs != null) {
      for (FunctionCallExpr aggExpr: aggExprs) {
        Preconditions.checkState(aggExpr.isAggregateFunction());
        if (aggExpr.isDistinct()) distinctAggExprs.add(aggExpr);
      }
    }
    if (distinctAggExprs.isEmpty()) {
      if (tupleDesc == null) {
        result.aggTupleDesc_ = result.createAggTupleDesc(analyzer);
      } else {
        result.aggTupleDesc_ = tupleDesc;
      }
      result.createMergeAggInfo(analyzer);
    } else {
      Preconditions.checkState(tupleDesc == null);
      result.createDistinctAggInfo(groupingExprs, distinctAggExprs, analyzer);
    }
    LOG.debug("agg info:\n" + result.debugString());
    return result;
  }
static public AggregateInfo create ( ArrayList < Expr > groupingExprs , ArrayList < FunctionCallExpr > aggExprs , TupleDescriptor tupleDesc , Analyzer analyzer ) throws AnalysisException , InternalException , AuthorizationException { Preconditions . checkState ( ( groupingExprs != null && ! groupingExprs . isEmpty ( ) ) || ( aggExprs != null && ! aggExprs . isEmpty ( ) ) ) ; Expr . removeDuplicates ( groupingExprs ) ; Expr . removeDuplicates ( aggExprs ) ; AggregateInfo result = new AggregateInfo ( groupingExprs , aggExprs , false ) ; ArrayList < FunctionCallExpr > distinctAggExprs = Lists . newArrayList ( ) ; if ( aggExprs != null ) { for ( FunctionCallExpr aggExpr : aggExprs ) { Preconditions . checkState ( aggExpr . isAggregateFunction ( ) ) ; if ( aggExpr . isDistinct ( ) ) distinctAggExprs . add ( aggExpr ) ; } } if ( distinctAggExprs . isEmpty ( ) ) { if ( tupleDesc == null ) { result . aggTupleDesc_ = result . createAggTupleDesc ( analyzer ) ; } else { result . aggTupleDesc_ = tupleDesc ; } result . createMergeAggInfo ( analyzer ) ; } else { Preconditions . checkState ( tupleDesc == null ) ; result . createDistinctAggInfo ( groupingExprs , distinctAggExprs , analyzer ) ; } LOG . debug ( "agg info:\n" + result . debugString ( ) ) ; return result ; }
Creates complete AggregateInfo for groupingExprs and aggExprs, including
 aggTupleDesc and aggTupleSMap.
Creates complete AggregateInfo for groupingExprs and aggExprs including aggTupleDesc and aggTupleSMap .
// collect agg exprs with DISTINCT clause // we don't allow you to pass in a descriptor for distinct aggregation // (we need two descriptors)