use of org.apache.druid.query.aggregation.SerializablePairLongStringSerde in project druid by druid-io.
the class ComplexMetricsTest method testConflicting.
@Test
public void testConflicting() {
ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde());
ComplexMetricSerde serde = ComplexMetrics.getSerdeForType("hyperUnique");
Assert.assertNotNull(serde);
Assert.assertTrue(serde instanceof HyperUniquesSerde);
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("Incompatible serializer for type[hyperUnique] already exists. Expected [org.apache.druid.query.aggregation.SerializablePairLongStringSerde], found [org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde");
ComplexMetrics.registerSerde("hyperUnique", new SerializablePairLongStringSerde());
serde = ComplexMetrics.getSerdeForType("hyperUnique");
Assert.assertNotNull(serde);
Assert.assertTrue(serde instanceof HyperUniquesSerde);
}
use of org.apache.druid.query.aggregation.SerializablePairLongStringSerde in project druid by druid-io.
the class StringFirstTimeseriesQueryTest method setUp.
@Before
public void setUp() throws IndexSizeExceededException {
final SerializablePairLongStringSerde serde = new SerializablePairLongStringSerde();
ComplexMetrics.registerSerde(serde.getTypeName(), serde);
incrementalIndex = new OnheapIncrementalIndex.Builder().setIndexSchema(new IncrementalIndexSchema.Builder().withQueryGranularity(Granularities.SECOND).withMetrics(new CountAggregatorFactory("cnt")).withMetrics(new StringFirstAggregatorFactory(FIRST_CLIENT_TYPE, CLIENT_TYPE, null, 1024)).build()).setMaxRowCount(1000).build();
incrementalIndex.add(new MapBasedInputRow(TIME1, Lists.newArrayList(VISITOR_ID, CLIENT_TYPE), ImmutableMap.of(VISITOR_ID, "0", CLIENT_TYPE, "iphone")));
incrementalIndex.add(new MapBasedInputRow(TIME1, Lists.newArrayList(VISITOR_ID, CLIENT_TYPE), ImmutableMap.of(VISITOR_ID, "1", CLIENT_TYPE, "iphone")));
incrementalIndex.add(new MapBasedInputRow(TIME2, Lists.newArrayList(VISITOR_ID, CLIENT_TYPE), ImmutableMap.of(VISITOR_ID, "0", CLIENT_TYPE, "android")));
queryableIndex = TestIndex.persistRealtimeAndLoadMMapped(incrementalIndex);
}
use of org.apache.druid.query.aggregation.SerializablePairLongStringSerde in project druid by druid-io.
the class StringLastTimeseriesQueryTest method setUp.
@Before
public void setUp() throws IndexSizeExceededException {
final SerializablePairLongStringSerde serde = new SerializablePairLongStringSerde();
ComplexMetrics.registerSerde(serde.getTypeName(), serde);
incrementalIndex = new OnheapIncrementalIndex.Builder().setIndexSchema(new IncrementalIndexSchema.Builder().withQueryGranularity(Granularities.SECOND).withMetrics(new CountAggregatorFactory("cnt")).withMetrics(new StringLastAggregatorFactory(LAST_CLIENT_TYPE, CLIENT_TYPE, null, 1024)).build()).setMaxRowCount(1000).build();
incrementalIndex.add(new MapBasedInputRow(TIME1, Lists.newArrayList(VISITOR_ID, CLIENT_TYPE), ImmutableMap.of(VISITOR_ID, "0", CLIENT_TYPE, "iphone")));
incrementalIndex.add(new MapBasedInputRow(TIME1, Lists.newArrayList(VISITOR_ID, CLIENT_TYPE), ImmutableMap.of(VISITOR_ID, "1", CLIENT_TYPE, "iphone")));
incrementalIndex.add(new MapBasedInputRow(TIME2, Lists.newArrayList(VISITOR_ID, CLIENT_TYPE), ImmutableMap.of(VISITOR_ID, "0", CLIENT_TYPE, "android")));
queryableIndex = TestIndex.persistRealtimeAndLoadMMapped(incrementalIndex);
}
Aggregations