Function definitions for later use in loadAggregate: Aggregate construction.
435374
function constructAggregate(){
		var ARObject = new ARConstructor();
		ARObject.setAggregateID(ARID);
		ARObject.setEventSink(eventSink);
		// If no snapshotter has been passed (or is not needed/used), instead of complicating logic, we simply replace it locally with a stub that knows no aggregates and rejects all loads.
		//  This happens in constructAggregate since it relies on the AR object existing.
		if(!snapshotter || !ARObject.supportsSnapshotApplication()){
			snapshotter = new NoOpSnapshotter();
		}
		ARObject.setSnapshotter(snapshotter);
		return ARObject;
	}
68146
private List<Set<Integer>> createInitialAggregates(
                List<Set<Integer>> N, boolean[] R) {
            C = new ArrayList<Set<Integer>>();

            for (int i = 0; i < R.length; ++i) {

                // Skip non-free nodes
                if (!R[i])
                    continue;

                // See if all nodes in the current N-set are free
                boolean free = true;
                for (int j : N.get(i))
                    free &= R[j];

                // Create an aggregate out of N[i]
                if (free) {
                    C.add(new HashSet<Integer>(N.get(i)));
                    for (int j : N.get(i))
                        R[j] = false;
                }

            }

            return C;
        }
659665
def aggregator(name, func, *args, type=None):
    ''
    def _func(col, rows):  # wrap builtins so they can have a .type
        vals = list(col.getValues(rows))
        try:
            return func(vals, *args)
        except Exception as e:
            if len(vals) == 0:
                return None
            return e

    aggregators[name] = _defaggr(name, type, _func)
372724
private static List<Set<Integer>> enlargeAggregates(
                List<Set<Integer>> C, List<Set<Integer>> N, boolean[] R) {

            // Contains the aggregates each node is coupled to
            List<List<Integer>> belong = new ArrayList<List<Integer>>(R.length);
            for (int i = 0; i < R.length; ++i)
                belong.add(new ArrayList<Integer>());

            // Find which aggregate each node is coupled to. This is used for
            // the intersection between Ni and Ck
            for (int k = 0; k < C.size(); ++k)
                for (int j : C.get(k))
                    belong.get(j).add(k);

            // Number of nodes in the intersection between each C and Ni
            int[] intersect = new int[C.size()];

            for (int i = 0; i < R.length; ++i) {

                // Skip non-free nodes
                if (!R[i])
                    continue;

                // Find the number of nodes intersecting Ni and every C, and
                // keep a track on the largest overlap
                Arrays.fill(intersect, 0);
                int largest = 0, maxValue = 0;
                for (int j : N.get(i))

                    // The k-index is to an aggregate coupled to node j
                    for (int k : belong.get(j)) {
                        intersect[k]++;
                        if (intersect[k] > maxValue) {
                            largest = k;
                            maxValue = intersect[largest];
                        }
                    }

                // Add the node to the proper C-set, and mark it as used
                // Also, check if the node actually does couple to a set
                if (maxValue > 0) {
                    R[i] = false;
                    C.get(largest).add(i);
                }
            }

            return C;
        }
354594
function updateAggregations(response) {
  if(response.hasOwnProperty('aggregations')) {
    aggregationsBox.textContent = JSON.stringify(response.aggregations,
                                                 null, 2);
    show(aggregationsCard);
  }
  else {
    hide(aggregationsCard);
  }
}
1254727
function (cmd) {
    var aggregateId = dotty.get(cmd, this.definitions.command.aggregateId);
    var aggregateName = this.aggregate.name;
    var contextName = this.aggregate.context.name;

    var toLoad = [{
      context: contextName,
      aggregate: aggregateName,
      aggregateId: aggregateId
    }];

    if (_.isFunction(this.getStreamsInfo)) {
      toLoad = this.getStreamsInfo(cmd);
      if (!_.isArray(toLoad)) {
        toLoad = [toLoad];
      }
      toLoad.forEach(function (l) {
        l.aggregateId = l.aggregateId || aggregateId;
      });
    }

    if (toLoad[0].context !== contextName || toLoad[0].aggregate !== aggregateName) {
      throw new Error('First stream to load has to be the new one!');
    }

    return toLoad;
  }
410807
function MetricsProvider(screen) {

    /**
     * Setup the process to aggregate the data as and when it is necessary.
     *
     * @returns {void}
     */
    var setupAggregation =
      function setupAggregation() {
        // construct the aggregation container
        this._aggregation = _.reduce(AGGREGATE_TIME_LEVELS, function (prev, timeLevel) {
          prev[timeLevel] = {
            data: [],
            lastTimeIndex: undefined,
            lastAggregateIndex: 0,
            scrollOffset: 0
          };

          return prev;
        }, {});

        // an array of all available aggregation levels and metadata
        this.aggregationLevels = _.keys(this._aggregation);
        this.lowestAggregateTimeUnits = +this.aggregationLevels[0];
        this.highestAggregationKey = _.last(this.aggregationLevels);

        // remember when all this started
        this._startTime = Date.now();

        // this is where we stopped aggregating
        this._lastAggregationIndex = 0;
      }.bind(this);

    EventEmitter.call(this);

    // the low-level container of all metrics provided
    this._metrics = [];

    // setup for aggregation
    setupAggregation();

    // initialize the zoom level to the lowest level
    this.setZoomLevel(0);

    // callback handlers
    screen.on("metrics", this._onMetrics.bind(this));
    screen.on("zoomGraphs", this.adjustZoomLevel.bind(this));
    screen.on("scrollGraphs", this.adjustScrollOffset.bind(this));
    screen.on("startGraphs", this.startGraphs.bind(this));
    screen.on("resetGraphs", this.resetGraphs.bind(this));
  }
571067
def aggregate(self, query: Optional[dict] = None,
                  group: Optional[dict] = None,
                  order_by: Union[None, list, tuple] = None) -> list:
        """"""
        raise NotImplementedError
1359565
function addAllToAggregation(aObjects) {
			for (var i = 0, len = aObjects.length; i < len; i++) {
				var vObject = aObjects[i];
				if ( Array.isArray(vObject) ) {
					addAllToAggregation(vObject);
				} else {
					that[oKeyInfo._sMutator](makeObject(vObject, oKeyInfo, oScope));
				}
			}
		}
951773
function (aggId, cmd) {
    var aggregate = '';
    if (dotty.exists(cmd, this.definitions.command.aggregate)) {
      aggregate = dotty.get(cmd, this.definitions.command.aggregate);
    }

    var context = '';
    if (dotty.exists(cmd, this.definitions.command.context)) {
      context = dotty.get(cmd, this.definitions.command.context);
    }

    return context + aggregate + aggId;
  }
972896
def aggregate(parsed_files)
      agr = Aggregator.new
      parsed_files.each do |file|
        Logger.log("Aggregating", file.filename)
        agr.aggregate(file)
      end
      agr.result
    end
384237
public static AggregationMetric BuildAggregationMetric(String string, TableDefinition definition) {
        ArrayList<AggregationMetric> metrics = BuildAggregationMetrics(string, definition);
        return metrics.get(0);
    }
810959
def aggregate(self, dimensions=None, function=None, spreadfn=None, **kwargs):
        
        kwargs['_method_args'] = (dimensions, function, spreadfn)
        return self.__call__('aggregate', **kwargs)
775005
function(func, context, argCount) {
                if (context === void 0) return func;
                switch (argCount == null ? 3 : argCount) {
                  case 1: return function(value) {
                    return func.call(context, value);
                  };
                  case 2: return function(value, other) {
                    return func.call(context, value, other);
                  };
                  case 3: return function(value, index, collection) {
                    return func.call(context, value, index, collection);
                  };
                  case 4: return function(accumulator, value, index, collection) {
                    return func.call(context, accumulator, value, index, collection);
                  };
                }
                return function() {
                  return func.apply(context, arguments);
                };
              }
1011582
def load_aggregate(args):
    """"""
    repos = load_config(args.config, args.expand_env)
    dirmatch = args.dirmatch
    for repo_dict in repos:
        r = Repo(**repo_dict)
        logger.debug('%s' % r)
        if not match_dir(r.cwd, dirmatch):
            logger.info("Skip %s", r.cwd)
            continue
        r.aggregate()
        if args.do_push:
            r.push()
705171
private static int aggregateDimValue(
      final int[] positions,
      final BufferAggregator[] theAggregators,
      final ByteBuffer resultsBuf,
      final int numBytesPerRecord,
      final int[] aggregatorOffsets,
      final int aggSize,
      final int aggExtra,
      final int dimIndex,
      int currentPosition
  )
  {
    if (SKIP_POSITION_VALUE == positions[dimIndex]) {
      return currentPosition;
    }
    if (INIT_POSITION_VALUE == positions[dimIndex]) {
      positions[dimIndex] = currentPosition * numBytesPerRecord;
      currentPosition++;
      final int pos = positions[dimIndex];
      for (int j = 0; j < aggSize; ++j) {
        theAggregators[j].init(resultsBuf, pos + aggregatorOffsets[j]);
      }
    }
    final int position = positions[dimIndex];

    switch (aggExtra) {
      case 7:
        theAggregators[6].aggregate(resultsBuf, position + aggregatorOffsets[6]);
        // fall through
      case 6:
        theAggregators[5].aggregate(resultsBuf, position + aggregatorOffsets[5]);
        // fall through
      case 5:
        theAggregators[4].aggregate(resultsBuf, position + aggregatorOffsets[4]);
        // fall through
      case 4:
        theAggregators[3].aggregate(resultsBuf, position + aggregatorOffsets[3]);
        // fall through
      case 3:
        theAggregators[2].aggregate(resultsBuf, position + aggregatorOffsets[2]);
        // fall through
      case 2:
        theAggregators[1].aggregate(resultsBuf, position + aggregatorOffsets[1]);
        // fall through
      case 1:
        theAggregators[0].aggregate(resultsBuf, position + aggregatorOffsets[0]);
    }
    for (int j = aggExtra; j < aggSize; j += AGG_UNROLL_COUNT) {
      theAggregators[j].aggregate(resultsBuf, position + aggregatorOffsets[j]);
      theAggregators[j + 1].aggregate(resultsBuf, position + aggregatorOffsets[j + 1]);
      theAggregators[j + 2].aggregate(resultsBuf, position + aggregatorOffsets[j + 2]);
      theAggregators[j + 3].aggregate(resultsBuf, position + aggregatorOffsets[j + 3]);
      theAggregators[j + 4].aggregate(resultsBuf, position + aggregatorOffsets[j + 4]);
      theAggregators[j + 5].aggregate(resultsBuf, position + aggregatorOffsets[j + 5]);
      theAggregators[j + 6].aggregate(resultsBuf, position + aggregatorOffsets[j + 6]);
      theAggregators[j + 7].aggregate(resultsBuf, position + aggregatorOffsets[j + 7]);
    }
    return currentPosition;
  }
985795
public void processMetricAggregation() {
        if (!isEmpty(metricAggregation)) {
            String[] aggregations = metricAggregation.split(";");
            for (int i = 0; i < aggregations.length; i++) {
                String definition = aggregations[i].trim();
                int index0 = definition.indexOf("=");
                int index1 = definition.indexOf("(");
                int index2 = definition.indexOf(")");
                String aggregatedName = definition.substring(0, index0);
                String operation = definition.substring(index0 + 1, index1);
                String parameters = definition.substring(index1 + 1, index2);
                List<String> metricNames = new ArrayList<>();
                metricNames.add(operation);
                // Case a list of metricNames
                if (parameters.contains(",")) {
                    String[] listMetricNames = parameters.split(",");
                    for (int j = 0; j < listMetricNames.length; j++) {
                        metricNames.add(listMetricNames[j].trim());
                    }
                } else {
                    Pattern pattern = Pattern.compile(parameters);
                    for (String metricName : nameIdMetrics.keySet()) {
                        if (pattern.matcher(metricName).matches()) {
                            metricNames.add(metricName);
                        }
                    }
                }
                aggregatedMetrics.put(aggregatedName, metricNames);
            }
            log.debugf("Gnocchi Aggregated Metrics from %s -> %s", metricAggregation, aggregatedMetrics);
        }
    }