Examples of Aggregator


Examples of org.apache.phoenix.expression.aggregator.Aggregator

        try {
            for (int i = 0; i < queries.length; i++) {
                query = queries[i];
                Scan scan = compileQuery(query, binds);
                ServerAggregators aggregators = ServerAggregators.deserialize(scan.getAttribute(BaseScannerRegionObserver.AGGREGATORS), null);
                Aggregator aggregator = aggregators.getAggregators()[0];
                assertTrue(aggregator instanceof CountAggregator);
            }
        } catch (Exception e) {
            throw new Exception(query, e);
        }
View Full Code Here

Examples of org.apache.phoenix.expression.aggregator.Aggregator

    public Aggregator newClientAggregator() {
        return newServerAggregator(null);
    }

    public Aggregator newServerAggregator(Configuration config, ImmutableBytesWritable ptr) {
        Aggregator agg = newServerAggregator(config);
        agg.aggregate(null, ptr);
        return agg;
    }
View Full Code Here

Examples of org.apache.phoenix.expression.aggregator.Aggregator

        try {
            for (int i = 0; i < queries.length; i++) {
                query = queries[i];
                Scan scan = compileQuery(query, binds);
                ServerAggregators aggregators = ServerAggregators.deserialize(scan.getAttribute(GroupedAggregateRegionObserver.AGGREGATORS), null);
                Aggregator aggregator = aggregators.getAggregators()[0];
                assertTrue(aggregator instanceof CountAggregator);
            }
        } catch (Exception e) {
            throw new Exception(query, e);
        }
View Full Code Here

Examples of org.apache.phoenix.expression.aggregator.Aggregator

        try {
            for (int i = 0; i < queries.length; i++) {
                query = queries[i];
                Scan scan = compileQuery(query, binds);
                ServerAggregators aggregators = ServerAggregators.deserialize(scan.getAttribute(BaseScannerRegionObserver.AGGREGATORS), null);
                Aggregator aggregator = aggregators.getAggregators()[0];
                assertTrue(aggregator instanceof CountAggregator);
            }
        } catch (Exception e) {
            throw new Exception(query, e);
        }
View Full Code Here

Examples of org.elasticsearch.search.aggregations.Aggregator

            // them will cause loads of redundant object constructions). The "special" comparators here will fetch the
            // sub aggregation values directly from the sub aggregators bypassing bucket creation. Note that the comparator
            // attached to the order will still be used in the reduce phase of the Aggregation.

            OrderPath path = path();
            final Aggregator aggregator = path.resolveAggregator(termsAggregator);
            final String key = path.tokens[path.tokens.length - 1].key;

            if (aggregator instanceof SingleBucketAggregator) {
                assert key == null : "this should be picked up before the aggregation is executed - on validate";
                return new Comparator<Terms.Bucket>() {
View Full Code Here

Examples of org.yaac.server.egql.evaluator.aggregator.Aggregator

        // since final results are generated from group by table
        groupByRecords.add(groupByRecord(record));
       
        // step 2 : evaluate all aggregation functions
        for (AggregationEvaluator e : aggregationEvaluators) {
          Aggregator agg = lookupAggregator(record, e);
         
          if (agg == null) {           
            // new aggregator
            agg = e.getType().newAggregator();
            // push back to context
            putAggregator(record, e, agg);
          }
         
          e.aggregate(record, agg);
       
      } else // write result to output
        final Map<String, EvaluationResult> resultRow = newLinkedHashMap();
       
        for (Evaluator e : selectItems) {
          resultRow.put(e.getText(), e.evaluate(record));
        }
       
        output.addRecord(new ProcessDataRecord() {
          Map<String, EvaluationResult> expandedRow = expandSelectAllAndResolveDuplicateName(resultRow);
         
          @Override
          public EvaluationResult lookup(String name) {
            return expandedRow.get(name);
          }
         
          @Override
          public Iterable<EvaluationResult> asIterable() {
            return expandedRow.values();
          }

          @Override
          public FileDownloadPath lookupFileReference(Integer index) {
            throw new IllegalArgumentException();
          }
        });
      }
    }
   
    // last batch finished, append group by clause
    if (context.getStatus() == ResultStatus.FINISHED) {
      // if a statement is finished, then append all group by results
      for (final Map<String, Object> rowKey : this.groupByRecords) {
       
        ProcessDataRecord record = new ProcessDataRecord() {         
          @Override
          public EvaluationResult lookup(String name) {
            // must resolve aggregators first, because count(1) is a valid property name in appengine
            Map<AggregationEvaluator, Aggregator> aggMap = groupByTable.row(rowKey);
            for (AggregationEvaluator e : aggMap.keySet()) {
              if (e.getText().equals(name)) {
                Aggregator agg = aggMap.get(e);
               
                if (agg == null) {
                  // for aggregation ONLY query
                  //  when there is no record, the empty group by function is still trying to resolve aggregator
                  return new EvaluationResult(null).withTitle(e.getText())
                } else {
                  return new EvaluationResult(agg.getResult()).withTitle(e.getText());
                }
              }
            }
           
            // fallback with other evaluators
View Full Code Here

Examples of simplenlg.aggregation.Aggregator

   * @param name
   *            the name
   */
  public ClauseAggregationTest(String name) {
    super(name);
    aggregator = new Aggregator();
    aggregator.initialise();
    coord = new ClauseCoordinationRule();
    fcr = new ForwardConjunctionReductionRule();
    bcr = new BackwardConjunctionReductionRule();
  }
View Full Code Here

Examples of storm.trident.operation.Aggregator

            throw new IllegalArgumentException("Output fields for chained aggregators must be distinct: " + allOutFields.toString());
        }
       
        Fields inFields = new Fields(new ArrayList<String>(allInFields));
        Fields outFields = new Fields(allOutFields);
        Aggregator combined = new ChainedAggregatorImpl(aggs, inputFields, new ComboList.Factory(outSizes));
       
        if(_type!=AggType.FULL) {
            _stream = _stream.partitionAggregate(inFields, combined, outFields);
        }
        if(_type!=AggType.PARTITION) {
            _stream = _globalScheme.aggPartition(_stream);
            BatchToPartition singleEmit = _globalScheme.singleEmitPartitioner();
            Aggregator toAgg = combined;
            if(singleEmit!=null) {
                toAgg = new SingleEmitAggregator(combined, singleEmit);
            }
            // this assumes that inFields and outFields are the same for combineragg
            // assumption also made above
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.