@Override public AggregatorFactory getCombiningFactory() { return new DoubleMinAggregatorFactory(name, name, null, macroTable); }
@Test public void testCombine() { Assert.assertEquals(1.2d, ((Double) doubleMinAggFactory.combine(1.2, 3.4)).doubleValue(), 0.0001); }
@Test public void testEqualsAndHashCode() { DoubleMinAggregatorFactory one = new DoubleMinAggregatorFactory("name1", "fieldName1"); DoubleMinAggregatorFactory oneMore = new DoubleMinAggregatorFactory("name1", "fieldName1"); DoubleMinAggregatorFactory two = new DoubleMinAggregatorFactory("name2", "fieldName2"); Assert.assertEquals(one.hashCode(), oneMore.hashCode()); Assert.assertTrue(one.equals(oneMore)); Assert.assertFalse(one.equals(two)); }
@Override protected BaseDoubleColumnValueSelector selector(ColumnSelectorFactory metricFactory) { return getDoubleColumnSelector( metricFactory, Double.POSITIVE_INFINITY ); }
@Test public void testDoubleMinBufferAggregator() { BufferAggregator agg = doubleMinAggFactory.factorizeBuffered(colSelectorFactory); ByteBuffer buffer = ByteBuffer.wrap(new byte[Double.BYTES + Byte.BYTES]); agg.init(buffer, 0); aggregate(selector, agg, buffer, 0); aggregate(selector, agg, buffer, 0); aggregate(selector, agg, buffer, 0); aggregate(selector, agg, buffer, 0); Assert.assertEquals(values[2], ((Double) agg.get(buffer, 0)).doubleValue(), 0.0001); Assert.assertEquals((long) values[2], agg.getLong(buffer, 0)); Assert.assertEquals(values[2], agg.getFloat(buffer, 0), 0.0001); }
@Test public void testDoubleMinAggregator() { Aggregator agg = doubleMinAggFactory.factorize(colSelectorFactory); aggregate(selector, agg); aggregate(selector, agg); aggregate(selector, agg); aggregate(selector, agg); Assert.assertEquals(values[2], ((Double) agg.get()).doubleValue(), 0.0001); Assert.assertEquals((long) values[2], agg.getLong()); Assert.assertEquals(values[2], agg.getFloat(), 0.0001); }
@Override protected BaseDoubleColumnValueSelector selector(ColumnSelectorFactory metricFactory) { return getDoubleColumnSelector( metricFactory, Double.POSITIVE_INFINITY ); }
@Override public List<AggregatorFactory> getRequiredColumns() { return Collections.singletonList(new DoubleMinAggregatorFactory(fieldName, fieldName, expression, macroTable)); }
private static AggregatorFactory createMinAggregatorFactory( final ValueType aggregationType, final String name, final String fieldName, final String expression, final ExprMacroTable macroTable ) { switch (aggregationType) { case LONG: return new LongMinAggregatorFactory(name, fieldName, expression, macroTable); case FLOAT: return new FloatMinAggregatorFactory(name, fieldName, expression, macroTable); case DOUBLE: return new DoubleMinAggregatorFactory(name, fieldName, expression, macroTable); default: throw new ISE("Cannot create aggregator factory for type[%s]", aggregationType); } } }
queryAggs.add(new LongMaxAggregatorFactory("maxLongUniform", "maxLongUniform")); queryAggs.add(new DoubleSumAggregatorFactory("sumFloatNormal", "sumFloatNormal")); queryAggs.add(new DoubleMinAggregatorFactory("minFloatZipf", "minFloatZipf")); queryAggs.add(new HyperUniquesAggregatorFactory("hyperUniquesMet", "hyper"));
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")
Lists.newArrayList( new DoubleMaxAggregatorFactory("maxIndex", "index"), new DoubleMinAggregatorFactory("minIndex", "index")