Search in sources :

Example 16 with ConstantPostAggregator

use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.

the class MomentSketchQuantilePostAggregatorTest method testComparator.

@Test
public void testComparator() {
    expectedException.expect(IAE.class);
    expectedException.expectMessage("Comparing arrays of quantiles is not supported");
    PostAggregator postAgg = new MomentSketchQuantilePostAggregator("post", new ConstantPostAggregator("", 100), new double[] { 0.25, 0.75 });
    postAgg.getComparator();
}
Also used : PostAggregator(org.apache.druid.query.aggregation.PostAggregator) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) Test(org.junit.Test)

Example 17 with ConstantPostAggregator

use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.

the class MomentSketchQuantilePostAggregatorTest method testToString.

@Test
public void testToString() {
    PostAggregator postAgg = new MomentSketchQuantilePostAggregator("post", new ConstantPostAggregator("", 100), new double[] { 0.25, 0.75 });
    Assert.assertEquals("MomentSketchQuantilePostAggregator{name='post', field=ConstantPostAggregator{name='', constantValue=100}, fractions=[0.25, 0.75]}", postAgg.toString());
}
Also used : PostAggregator(org.apache.druid.query.aggregation.PostAggregator) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) Test(org.junit.Test)

Example 18 with ConstantPostAggregator

use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.

the class TDigestSketchToQuantilesPostAggregatorTest method testToString.

@Test
public void testToString() {
    PostAggregator postAgg = new TDigestSketchToQuantilesPostAggregator("post", new ConstantPostAggregator("", 100), new double[] { 0.25, 0.75 });
    Assert.assertEquals("TDigestSketchToQuantilesPostAggregator{name='post', field=ConstantPostAggregator{name='', constantValue=100}, fractions=[0.25, 0.75]}", postAgg.toString());
}
Also used : PostAggregator(org.apache.druid.query.aggregation.PostAggregator) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) Test(org.junit.Test)

Example 19 with ConstantPostAggregator

use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.

the class TDigestSketchToQuantilePostAggregatorTest method testSerde.

@Test
public void testSerde() throws Exception {
    TDigestSketchToQuantilePostAggregator there = new TDigestSketchToQuantilePostAggregator("post", new ConstantPostAggregator("", 100), 0.5);
    DefaultObjectMapper mapper = new DefaultObjectMapper();
    TDigestSketchToQuantilePostAggregator andBackAgain = mapper.readValue(mapper.writeValueAsString(there), TDigestSketchToQuantilePostAggregator.class);
    Assert.assertEquals(there, andBackAgain);
    Assert.assertArrayEquals(there.getCacheKey(), andBackAgain.getCacheKey());
    Assert.assertEquals(there.getDependentFields(), andBackAgain.getDependentFields());
}
Also used : ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Test(org.junit.Test)

Example 20 with ConstantPostAggregator

use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.

the class TDigestSketchToQuantilePostAggregatorTest method testToString.

@Test
public void testToString() {
    PostAggregator postAgg = new TDigestSketchToQuantilePostAggregator("post", new ConstantPostAggregator("", 100), 0.5);
    Assert.assertEquals("TDigestSketchToQuantilePostAggregator{name='post', field=ConstantPostAggregator{name='', constantValue=100}, fraction=0.5}", postAgg.toString());
}
Also used : PostAggregator(org.apache.druid.query.aggregation.PostAggregator) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) ConstantPostAggregator(org.apache.druid.query.aggregation.post.ConstantPostAggregator) Test(org.junit.Test)

Aggregations

ConstantPostAggregator (org.apache.druid.query.aggregation.post.ConstantPostAggregator)61 Test (org.junit.Test)58 PostAggregator (org.apache.druid.query.aggregation.PostAggregator)33 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)14 CountAggregatorFactory (org.apache.druid.query.aggregation.CountAggregatorFactory)14 DefaultDimensionSpec (org.apache.druid.query.dimension.DefaultDimensionSpec)12 FieldAccessPostAggregator (org.apache.druid.query.aggregation.post.FieldAccessPostAggregator)11 ArithmeticPostAggregator (org.apache.druid.query.aggregation.post.ArithmeticPostAggregator)10 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)9 LongSumAggregatorFactory (org.apache.druid.query.aggregation.LongSumAggregatorFactory)8 TimeseriesQuery (org.apache.druid.query.timeseries.TimeseriesQuery)8 TimeseriesQueryQueryToolChest (org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 MultipleIntervalSegmentSpec (org.apache.druid.query.spec.MultipleIntervalSegmentSpec)4 Result (org.apache.druid.query.Result)3 TableDataSource (org.apache.druid.query.TableDataSource)3 AggregatorFactory (org.apache.druid.query.aggregation.AggregatorFactory)3 DoubleSumAggregatorFactory (org.apache.druid.query.aggregation.DoubleSumAggregatorFactory)3 EqualToHavingSpec (org.apache.druid.query.groupby.having.EqualToHavingSpec)3 GreaterThanHavingSpec (org.apache.druid.query.groupby.having.GreaterThanHavingSpec)3