@Override public String getName() { return delegate.getName(); }
@Override public boolean apply(AggregatorFactory input) { return input.getName().equals(metric); } }
@JsonProperty @Override public String getName() { String name = this.name; if (Strings.isNullOrEmpty(name)) { name = delegate.getName(); } return name; }
private static Map<String, AggregatorFactory> getAggregatorsMap(List<AggregatorFactory> aggregatorSpecs) { Map<String, AggregatorFactory> map = new HashMap<>(aggregatorSpecs.size()); aggregatorSpecs.forEach(v -> map.put(v.getName(), v)); return map; }
public static int getAggIndexForOrderBy(OrderByColumnSpec orderSpec, List<AggregatorFactory> aggregatorFactories) { int i = 0; for (AggregatorFactory agg : aggregatorFactories) { if (orderSpec.getDimension().equals((agg.getName()))) { return i; } i++; } return -1; }
public String getOutputName() { return postAggregator != null ? postAggregator.getName() : Iterables.getOnlyElement(aggregatorFactories).getName(); }
private void factorizeAggs( AggregatorFactory[] metrics, Aggregator[] aggs, ThreadLocal<InputRow> rowContainer, InputRow row ) { rowContainer.set(row); for (int i = 0; i < metrics.length; i++) { final AggregatorFactory agg = metrics[i]; aggs[i] = agg.factorize(selectors.get(agg.getName())); } rowContainer.set(null); }
private static String getType(String metric, AggregatorFactory[] aggs, int i) { if (aggs[i].getName().equals(metric)) { return aggs[i].getTypeName(); } log.warn("Aggs disordered, fall backs to loop."); for (AggregatorFactory agg : aggs) { if (agg.getName().equals(metric)) { return agg.getTypeName(); } } return null; }
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && other.getClass() == this.getClass()) { JavaScriptAggregatorFactory castedOther = (JavaScriptAggregatorFactory) other; if (this.fnCombine.equals(castedOther.fnCombine) && this.fnReset.equals(castedOther.fnReset)) { return getCombiningFactory(); } } throw new AggregatorFactoryNotMergeableException(this, other); }
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && this.getClass() == other.getClass()) { return getCombiningFactory(); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && this.getClass() == other.getClass()) { return getCombiningFactory(); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && this.getClass() == other.getClass()) { return getCombiningFactory(); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && this.getClass() == other.getClass()) { return getCombiningFactory(); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && this.getClass() == other.getClass()) { return getCombiningFactory(); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && other instanceof DoublesSketchAggregatorFactory) { // DoublesUnion supports inputs with different k. // The result will have effective k between the specified k and the minimum k from all input sketches // to achieve higher accuracy as much as possible. return new DoublesSketchMergeAggregatorFactory(name, Math.max(k, ((DoublesSketchAggregatorFactory) other).k)); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (Objects.equals(getName(), other.getName()) && other instanceof VarianceAggregatorFactory) { return getCombiningFactory(); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
@Override public Row apply(Row input) { if (input instanceof MapBasedRow) { final MapBasedRow inputRow = (MapBasedRow) input; final Map<String, Object> values = new HashMap<>(inputRow.getEvent()); for (AggregatorFactory agg : query.getAggregatorSpecs()) { values.put(agg.getName(), fn.manipulate(agg, inputRow.getEvent().get(agg.getName()))); } return new MapBasedRow(inputRow.getTimestamp(), values); } return input; } };
@Override public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException { if (other.getName().equals(this.getName()) && other instanceof SketchMergeAggregatorFactory) { SketchMergeAggregatorFactory castedOther = (SketchMergeAggregatorFactory) other; return new SketchMergeAggregatorFactory( name, name, Math.max(size, castedOther.size), shouldFinalize, false, errorBoundsStdDev ); } else { throw new AggregatorFactoryNotMergeableException(this, other); } }
SettableColumnSelectorFactory(AggregatorFactory[] aggregatorFactories) { columnIndexMap = new Object2IntArrayMap<>(aggregatorFactories.length); columnIndexMap.defaultReturnValue(UNKNOWN_COLUMN_INDEX); for (int i = 0; i < aggregatorFactories.length; i++) { columnIndexMap.put(aggregatorFactories[i].getName(), i); } }