use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class DoublesSketchToStringPostAggregatorTest method testComparator.
@Test
public void testComparator() {
expectedException.expect(IAE.class);
expectedException.expectMessage("Comparing sketch summaries is not supported");
final PostAggregator postAgg = new DoublesSketchToStringPostAggregator("post", new FieldAccessPostAggregator("field1", "sketch"));
postAgg.getComparator();
}
use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class DoublesSketchToStringPostAggregatorTest method testSerde.
@Test
public void testSerde() throws JsonProcessingException {
final PostAggregator there = new DoublesSketchToStringPostAggregator("post", new FieldAccessPostAggregator("field1", "sketch"));
DefaultObjectMapper mapper = new DefaultObjectMapper();
DoublesSketchToStringPostAggregator andBackAgain = mapper.readValue(mapper.writeValueAsString(there), DoublesSketchToStringPostAggregator.class);
Assert.assertEquals(there, andBackAgain);
Assert.assertArrayEquals(there.getCacheKey(), andBackAgain.getCacheKey());
}
use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class SketchAggregationTest method testSketchSetPostAggregatorSerde.
@Test
public void testSketchSetPostAggregatorSerde() throws Exception {
assertPostAggregatorSerde(new SketchSetPostAggregator("name", "INTERSECT", null, Lists.newArrayList(new FieldAccessPostAggregator("name1", "fieldName1"), new FieldAccessPostAggregator("name2", "fieldName2"))));
assertPostAggregatorSerde(new SketchSetPostAggregator("name", "INTERSECT", null, Lists.newArrayList(new FieldAccessPostAggregator("name1", "fieldName1"), new SketchConstantPostAggregator("name2", "AgMDAAAazJMCAAAAAACAPzz9j7pWTMdROWGf15uY1nI="))));
}
use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class SketchAggregatorFactoryTest method testResultArraySignature.
@Test
public void testResultArraySignature() {
final TimeseriesQuery query = Druids.newTimeseriesQueryBuilder().dataSource("dummy").intervals("2000/3000").granularity(Granularities.HOUR).aggregators(new CountAggregatorFactory("count"), new OldSketchBuildAggregatorFactory("oldBuild", "col", 16), new OldSketchMergeAggregatorFactory("oldMerge", "col", 16, false), new OldSketchMergeAggregatorFactory("oldMergeFinalize", "col", 16, true), new SketchMergeAggregatorFactory("merge", "col", 16, false, false, null), new SketchMergeAggregatorFactory("mergeFinalize", "col", 16, true, false, null)).postAggregators(new FieldAccessPostAggregator("oldBuild-access", "oldBuild"), new FinalizingFieldAccessPostAggregator("oldBuild-finalize", "oldBuild"), new FieldAccessPostAggregator("oldMerge-access", "oldMerge"), new FinalizingFieldAccessPostAggregator("oldMerge-finalize", "oldMerge"), new FieldAccessPostAggregator("oldMergeFinalize-access", "oldMergeFinalize"), new FinalizingFieldAccessPostAggregator("oldMergeFinalize-finalize", "oldMergeFinalize"), new FieldAccessPostAggregator("merge-access", "merge"), new FinalizingFieldAccessPostAggregator("merge-finalize", "merge"), new FieldAccessPostAggregator("mergeFinalize-access", "mergeFinalize"), new FinalizingFieldAccessPostAggregator("mergeFinalize-finalize", "mergeFinalize"), new SketchEstimatePostAggregator("sketchEstimate", new FieldAccessPostAggregator(null, "merge"), null), new SketchEstimatePostAggregator("sketchEstimateStdDev", new FieldAccessPostAggregator(null, "merge"), 2), new SketchSetPostAggregator("sketchSet", "UNION", null, ImmutableList.of(new FieldAccessPostAggregator(null, "oldMerge"), new FieldAccessPostAggregator(null, "merge"))), new SketchToStringPostAggregator("sketchString", new FieldAccessPostAggregator(null, "merge"))).build();
Assert.assertEquals(RowSignature.builder().addTimeColumn().add("count", ColumnType.LONG).add("oldBuild", null).add("oldMerge", SketchModule.MERGE_TYPE).add("oldMergeFinalize", null).add("merge", SketchModule.BUILD_TYPE).add("mergeFinalize", null).add("oldBuild-access", SketchModule.BUILD_TYPE).add("oldBuild-finalize", ColumnType.DOUBLE).add("oldMerge-access", SketchModule.MERGE_TYPE).add("oldMerge-finalize", SketchModule.MERGE_TYPE).add("oldMergeFinalize-access", SketchModule.MERGE_TYPE).add("oldMergeFinalize-finalize", ColumnType.DOUBLE).add("merge-access", SketchModule.BUILD_TYPE).add("merge-finalize", SketchModule.BUILD_TYPE).add("mergeFinalize-access", SketchModule.BUILD_TYPE).add("mergeFinalize-finalize", ColumnType.DOUBLE).add("sketchEstimate", ColumnType.DOUBLE).add("sketchEstimateStdDev", SketchModule.MERGE_TYPE).add("sketchSet", SketchModule.MERGE_TYPE).add("sketchString", ColumnType.STRING).build(), new TimeseriesQueryQueryToolChest().resultArraySignature(query));
}
use of org.apache.druid.query.aggregation.post.FieldAccessPostAggregator in project druid by druid-io.
the class HllSketchToEstimateWithBoundsPostAggregatorTest method testSerde.
@Test
public void testSerde() throws JsonProcessingException {
final PostAggregator there = new HllSketchToEstimateWithBoundsPostAggregator("post", new FieldAccessPostAggregator("field1", "sketch"), 2);
DefaultObjectMapper mapper = new DefaultObjectMapper();
HllSketchToEstimateWithBoundsPostAggregator andBackAgain = mapper.readValue(mapper.writeValueAsString(there), HllSketchToEstimateWithBoundsPostAggregator.class);
Assert.assertEquals(there, andBackAgain);
Assert.assertArrayEquals(there.getCacheKey(), andBackAgain.getCacheKey());
}
Aggregations