a function to understand if to skip aggregations
971394
function (oControl) {
			return oControl instanceof this._oWindow.sap.ui.core.mvc.View && oControl !== that._oView;
		}
10683
function record(name, num, statistics, aggregations, timestamp, callback) {
        timestamp = timestamp || Date.now();
        function recordStats(key) {
            statistics && statistics.forEach(function(stat) {
                    if(stat == 'sum') {
                        multi.hincrby(key, 'sum', num)
                    } else if(scripts[stat]){
                        evalScript(multi, stat, [key, num],[],function(err, result) {
                                if(err) throw err;
                                if(result && result.indexOf('ERR') == 0) {
                                    // console.log(scripts[stat]);
                                    throw new Error(result);
                                }
                        })
                    }
            });
        }
        if(!statistics) statistics = ['sum'];
        if(num == undefined) num = 1;

        var multi = redis.multi();

        granularities.forEach(function(gran) {
                var key = getGranKey(name, gran, timestamp);
                recordStats(key);
                var unitPeriod = gran[0];
                multi.expire(key, points * unitPeriod / 1000);
        });

        if(aggregations) for(var i = 0; i < aggregations.length; i++) {
            var aggr = aggregations[i];
            var key = getAggrKey(name, aggr, timestamp);
            recordStats(key);
        }

        multi.exec(callback || log);
    }
414718
function (aggregate, streams, clb) {
        if (hadNoAggregateId) return clb(null, aggregate, streams);
        debug('');
        self.checkAggregateLock(concatenatedId, function (err) {
          clb(err, aggregate, streams);
        });
      }
781653
function make_bucket_agg(groupby, subagg) {
    var bucket_agg = {};
    groupby.forEach(function(field) {
        bucket_agg[field] = {
            terms: {
                field: field,
                size: _calculate_size_for_aggregation(subagg)
            }
        };
    });

    return _.reduceRight(bucket_agg, function nest(memo, value, key) {
        var obj = {};

        if (!_.isEmpty(memo)) {
            value.aggregations = memo;
        }

        obj[key] = value;

        return obj;
    }, subagg);
}
543847
private AggregationBuilder buildSelectAggregations(AggregationBuilder aggregationBuilder,
            SelectStatement selectStatement, EntityMetadata entityMetadata)
    {
        Expression expression = ((SelectClause) selectStatement.getSelectClause()).getSelectExpression();

        if (expression instanceof CollectionExpression)
        {
            aggregationBuilder = appendAggregation((CollectionExpression) expression, entityMetadata,
                    aggregationBuilder);
        }
        else
        {
            if (isAggregationExpression(expression) && checkIfKeyExists(expression.toParsedText()))
                aggregationBuilder.subAggregation(getMetricsAggregation(expression, entityMetadata));
        }
        return aggregationBuilder;
    }
950022
def aggregate_grouploop(*args, **kwargs):
    """"""
    extrafuncs = {'allnan': allnan, 'anynan': anynan,
                  'first': itemgetter(0), 'last': itemgetter(-1),
                  'nanfirst': nanfirst, 'nanlast': nanlast}
    func = kwargs.pop('func')
    func = extrafuncs.get(func, func)
    if isinstance(func, str):
        raise NotImplementedError("Grouploop needs to be called with a function")
    return aggregate_numpy.aggregate(*args, func=lambda x: func(x), **kwargs)
1194500
def aggregate(self, val1, val2):
        """"""
        assert val1 is not None
        assert val2 is not None
        return self._aggregator(val1, val2)
104645
function (aggregate, cmd) {
    if (!aggregate || !_.isObject(aggregate)) {
      var err = new Error('Please pass a valid aggregate!');
      debug(err);
      throw err;
    }
    if (!cmd || !_.isObject(cmd)) {
      var err = new Error('Please pass a valid command!');
      debug(err);
      throw err;
    }

    var reason = this.isAggregateDestroyed(aggregate, cmd);
    if (reason) {
      return reason;
    }

    if (this.aggregate.disablePersistence) return;

    reason = this.isRevisionWrong(aggregate, cmd);
    if (reason) {
      return reason;
    }
  }
432462
def should_skip_middleware(self, middleware, matching, rest) -> bool:
        
        return bool(not matching) or bool(rest)
615884
function getAggregationFields(query, aggParam, supplimentalBanList) {
    let retVal = [];
    const _aggParam = aggParam || 'aggregations';

    if (!query[_aggParam]) {
      return retVal;
    }
    const _supplimentalBanList = supplimentalBanList || {};

    _.each(query[_aggParam].split(','), (agg) => {
      assertAggNameIsAllowed(agg, _supplimentalBanList);
      _supplimentalBanList[agg] = true;
      let _type = query[`${agg}.type`];
      !_type && (_type = 'terms');
      const aggOptions = permittedAggOptions[_type];
      _.each(aggOptions, (aggOption) => {
        const expectedOptionName = `${agg}.${aggOption}`;
        retVal.push(expectedOptionName);
      });

      if (query[`${agg}.aggregations`]) {
        const nestedAggFields = getAggregationFields(query, `${agg}.aggregations`, _supplimentalBanList);
        retVal = retVal.concat(nestedAggFields);
      }
    });
    return retVal;
  }
289987
def aggregate(cls, pipeline=None, **kwargs):
        
        return list(cls.collection.aggregate(pipeline or [], **kwargs))
261586
private int countNumberOfAggregates(Frame fr, int numberOfColumns, AstRoot asts[]) {
    int validGroupByCols = 0;
    for (int idx=3; idx < asts.length; idx+=3) {  // initial loop to count operations on valid columns, ignore String columns
      AstNumList col = check(numberOfColumns, asts[idx + 1]);
      if (col.cnt() != 1) throw new IllegalArgumentException("Group-By functions take only a single column");
      int agg_col = (int) col.min(); // Aggregate column
      if (fr.vec(agg_col).isString()) {
        Log.warn("Column "+fr._names[agg_col]+" is a string column.  Groupby operations will be skipped for this column.");
      } else
        validGroupByCols++;
    }
    return validGroupByCols;
  }
246149
function skipIndex() {
		if( childType && childType.indexOf('[]') === childType.length-2 ) {
			childType = childType.substring(0, childType.length-2);
		}
	}
92033
private static int aggregateStamp(int stamp_a, int stamp_b) {
        if (stamp_a == UNSET || stamp_b == UNSET) {
            return UNSET;
        }
        return (stamp_a > stamp_b) ? stamp_a : stamp_b;
    }
322414
def should_aggregate(self, req):
        
        try:
            return self.app.config.get('ELASTICSEARCH_AUTO_AGGREGATIONS') or \
                   bool(req.args and int(req.args.get('aggregations')))
        except (AttributeError, TypeError):
            return False
1021842
function aggregateParams(_, pulse) {
  var key    = _.field,
  value  = _.value,
      op     = (_.op === 'count' ? '__count__' : _.op) || 'sum',
      fields = accessorFields(key).concat(accessorFields(value)),
      keys   = pivotKeys(key, _.limit || 0, pulse);

  return {
    key:      _.key,
    groupby:  _.groupby,
    ops:      keys.map(function() { return op; }),
    fields:   keys.map(function(k) { return get(k, key, value, fields); }),
    as:       keys.map(function(k) { return k + ''; }),
    modified: _.modified.bind(_)
  };
}
1181662
def _aggop(self, query):
        
        if isinstance(query.select, list):
            # RETURN SINGLE OBJECT WITH AGGREGATES
            for s in query.select:
                if s.aggregate not in aggregates:
                    Log.error("Expecting all columns to have an aggregate: {{select}}", select=s)

            selects = FlatList()
            for s in query.select:
                selects.append(sql_alias(aggregates[s.aggregate].replace("{{code}}", s.value),quote_column(s.name)))

            sql = expand_template("""
                SELECT
                    {{selects}}
                FROM
                    {{table}}
                {{where}}
            """, {
                "selects": SQL(",\n".join(selects)),
                "table": self._subquery(query["from"])[0],
                "where": self._where2sql(query.filter)
            })

            return sql, lambda sql: self.db.column(sql)[0]  # RETURNING SINGLE OBJECT WITH AGGREGATE VALUES
        else:
            # RETURN SINGLE VALUE
            s0 = query.select
            if s0.aggregate not in aggregates:
                Log.error("Expecting all columns to have an aggregate: {{select}}", select=s0)

            select = sql_alias(aggregates[s0.aggregate].replace("{{code}}", s0.value) , quote_column(s0.name))

            sql = expand_template("""
                SELECT
                    {{selects}}
                FROM
                    {{table}}
                {{where}}
            """, {
                "selects": SQL(select),
                "table": self._subquery(query["from"])[0],
                "where": self._where2sql(query.where)
            })

            def post(sql):
                result = self.db.column_query(sql)
                return result[0][0]

            return sql, post