Search in sources :

Example 1 with SketchHolder

use of org.apache.druid.query.aggregation.datasketches.theta.SketchHolder in project druid by druid-io.

the class OldApiSketchAggregationTest method testRelocation.

@Test
public void testRelocation() {
    final TestColumnSelectorFactory columnSelectorFactory = GrouperTestUtil.newColumnSelectorFactory();
    SketchHolder sketchHolder = SketchHolder.of(Sketches.updateSketchBuilder().setNominalEntries(16).build());
    UpdateSketch updateSketch = (UpdateSketch) sketchHolder.getSketch();
    updateSketch.update(1);
    columnSelectorFactory.setRow(new MapBasedRow(0, ImmutableMap.of("sketch", sketchHolder)));
    SketchHolder[] holders = helper.runRelocateVerificationTest(new OldSketchMergeAggregatorFactory("sketch", "sketch", 16, false), columnSelectorFactory, SketchHolder.class);
    Assert.assertEquals(holders[0].getEstimate(), holders[1].getEstimate(), 0);
}
Also used : MapBasedRow(org.apache.druid.data.input.MapBasedRow) TestColumnSelectorFactory(org.apache.druid.query.groupby.epinephelinae.TestColumnSelectorFactory) SketchHolder(org.apache.druid.query.aggregation.datasketches.theta.SketchHolder) UpdateSketch(org.apache.datasketches.theta.UpdateSketch) GroupByQueryRunnerTest(org.apache.druid.query.groupby.GroupByQueryRunnerTest) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Aggregations

UpdateSketch (org.apache.datasketches.theta.UpdateSketch)1 MapBasedRow (org.apache.druid.data.input.MapBasedRow)1 SketchHolder (org.apache.druid.query.aggregation.datasketches.theta.SketchHolder)1 GroupByQueryRunnerTest (org.apache.druid.query.groupby.GroupByQueryRunnerTest)1 TestColumnSelectorFactory (org.apache.druid.query.groupby.epinephelinae.TestColumnSelectorFactory)1 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)1 Test (org.junit.Test)1