use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class ArrayOfDoublesSketchTTestPostAggregatorTest 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 ArrayOfDoublesSketchTTestPostAggregator("a", ImmutableList.of(new ConstantPostAggregator("", 0), new ConstantPostAggregator("", 0)))).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("a", ColumnType.DOUBLE_ARRAY).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class ArrayOfDoublesSketchToEstimatePostAggregatorTest method testSerde.
@Test
public void testSerde() throws JsonProcessingException {
final PostAggregator there = new ArrayOfDoublesSketchToEstimatePostAggregator("a", new ConstantPostAggregator("", 0));
DefaultObjectMapper mapper = new DefaultObjectMapper();
ArrayOfDoublesSketchToEstimatePostAggregator andBackAgain = mapper.readValue(mapper.writeValueAsString(there), ArrayOfDoublesSketchToEstimatePostAggregator.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 ArrayOfDoublesSketchToEstimatePostAggregatorTest 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 ArrayOfDoublesSketchToEstimatePostAggregator("a", new ConstantPostAggregator("", 0))).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("a", ColumnType.DOUBLE).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
use of org.apache.druid.query.aggregation.post.ConstantPostAggregator in project druid by druid-io.
the class ArrayOfDoublesSketchSetOpPostAggregatorTest method testSerde.
@Test
public void testSerde() throws JsonProcessingException {
final PostAggregator there = new ArrayOfDoublesSketchSetOpPostAggregator("a", "UNION", null, null, Arrays.asList(new ConstantPostAggregator("", 0), new ConstantPostAggregator("", 0)));
DefaultObjectMapper mapper = new DefaultObjectMapper();
ArrayOfDoublesSketchSetOpPostAggregator andBackAgain = mapper.readValue(mapper.writeValueAsString(there), ArrayOfDoublesSketchSetOpPostAggregator.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 ArrayOfDoublesSketchSetOpPostAggregatorTest method testToString.
@Test
public void testToString() {
PostAggregator postAgg = new ArrayOfDoublesSketchSetOpPostAggregator("a", "UNION", 16, 1000, Arrays.asList(new ConstantPostAggregator("", 0), new ConstantPostAggregator("", 0)));
Assert.assertEquals("ArrayOfDoublesSketchSetOpPostAggregator{name='a', fields=[ConstantPostAggregator{name='', constantValue=0}, ConstantPostAggregator{name='', constantValue=0}], operation=UNION, nominalEntries=16, numberOfValues=1000}", postAgg.toString());
}
Aggregations