use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class MomentSketchQuantilePostAggregatorTest method testSerde.
@Test
public void testSerde() throws Exception {
MomentSketchQuantilePostAggregator there = new MomentSketchQuantilePostAggregator("post", new ConstantPostAggregator("", 100), new double[] { 0.25, 0.75 });
DefaultObjectMapper mapper = new DefaultObjectMapper();
MomentSketchQuantilePostAggregator andBackAgain = mapper.readValue(mapper.writeValueAsString(there), MomentSketchQuantilePostAggregator.class);
Assert.assertEquals(there, andBackAgain);
Assert.assertArrayEquals(there.getCacheKey(), andBackAgain.getCacheKey());
Assert.assertEquals(there.getDependentFields(), andBackAgain.getDependentFields());
}
use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class ArrayOfDoublesSketchSetOpPostAggregatorTest method testResultArraySignature.
@Test
public void testResultArraySignature() {
final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count")).postAggregators(new ArrayOfDoublesSketchSetOpPostAggregator("a", "UNION", null, null, ImmutableList.of(new ConstantPostAggregator("", 0), new ConstantPostAggregator("", 0)))).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("a", ArrayOfDoublesSketchModule.MERGE_TYPE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class ArrayOfDoublesSketchToMeansPostAggregatorTest method testToString.
@Test
public void testToString() {
PostAggregator postAgg = new ArrayOfDoublesSketchToMeansPostAggregator("a", new ConstantPostAggregator("", 0));
Assert.assertEquals("ArrayOfDoublesSketchToMeansPostAggregator{name='a', field=ConstantPostAggregator{name='', constantValue=0}}", postAgg.toString());
}
use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class ArrayOfDoublesSketchToMeansPostAggregatorTest method testSerde.
@Test
public void testSerde() throws JsonProcessingException {
final PostAggregator there = new ArrayOfDoublesSketchToMeansPostAggregator("a", new ConstantPostAggregator("", 0));
DefaultObjectMapper mapper = new DefaultObjectMapper();
ArrayOfDoublesSketchToMeansPostAggregator andBackAgain = mapper.readValue(mapper.writeValueAsString(there), ArrayOfDoublesSketchToMeansPostAggregator.class);
Assert.assertEquals(there, andBackAgain);
Assert.assertArrayEquals(there.getCacheKey(), andBackAgain.getCacheKey());
}
use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class ArrayOfDoublesSketchToMeansPostAggregatorTest method testResultArraySignature.
@Test
public void testResultArraySignature() {
final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count")).postAggregators(new ArrayOfDoublesSketchToMeansPostAggregator("a", new ConstantPostAggregator("", 0))).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("a", ColumnType.DOUBLE_ARRAY).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
Aggregations