Search in sources :

Example 1 with SerializablePairLongStringSerde

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);
}
Also used : SerializablePairLongStringSerde(org.apache.druid.query.aggregation.SerializablePairLongStringSerde) HyperUniquesSerde(org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde) Test(org.junit.Test)

Example 2 with SerializablePairLongStringSerde

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);
}
Also used : SerializablePairLongStringSerde(org.apache.druid.query.aggregation.SerializablePairLongStringSerde) CountAggregatorFactory(org.apache.druid.query.aggregation.CountAggregatorFactory) MapBasedInputRow(org.apache.druid.data.input.MapBasedInputRow) Before(org.junit.Before)

Example 3 with SerializablePairLongStringSerde

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);
}
Also used : SerializablePairLongStringSerde(org.apache.druid.query.aggregation.SerializablePairLongStringSerde) CountAggregatorFactory(org.apache.druid.query.aggregation.CountAggregatorFactory) MapBasedInputRow(org.apache.druid.data.input.MapBasedInputRow) Before(org.junit.Before)

Aggregations

SerializablePairLongStringSerde (org.apache.druid.query.aggregation.SerializablePairLongStringSerde)3 MapBasedInputRow (org.apache.druid.data.input.MapBasedInputRow)2 CountAggregatorFactory (org.apache.druid.query.aggregation.CountAggregatorFactory)2 Before (org.junit.Before)2 HyperUniquesSerde (org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde)1 Test (org.junit.Test)1