diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/FilterPartitionBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/FilterPartitionBenchmark.java index 58bbdc9119d..775aa0bb1ed 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/FilterPartitionBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/FilterPartitionBenchmark.java @@ -152,7 +152,7 @@ public class FilterPartitionBenchmark { log.info("SETUP CALLED AT " + System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); schemaInfo = GeneratorBasicSchemas.SCHEMA_MAP.get(schema); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/FilteredAggregatorBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/FilteredAggregatorBenchmark.java index ee07de77591..4d077d44388 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/FilteredAggregatorBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/FilteredAggregatorBenchmark.java @@ -158,7 +158,7 @@ public class FilteredAggregatorBenchmark { log.info("SETUP CALLED AT " + System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); schemaInfo = GeneratorBasicSchemas.SCHEMA_MAP.get(schema); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/GroupByTypeInterfaceBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/GroupByTypeInterfaceBenchmark.java index a37fab08228..3cb2f60b97d 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/GroupByTypeInterfaceBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/GroupByTypeInterfaceBenchmark.java @@ -273,7 +273,7 @@ public class GroupByTypeInterfaceBenchmark { log.info("SETUP CALLED AT %d", System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); setupQueries(); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/TopNTypeInterfaceBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/TopNTypeInterfaceBenchmark.java index 984d01ebde2..b96716aaf6e 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/TopNTypeInterfaceBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/TopNTypeInterfaceBenchmark.java @@ -238,7 +238,7 @@ public class TopNTypeInterfaceBenchmark { log.info("SETUP CALLED AT " + System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); setupQueries(); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IncrementalIndexReadBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IncrementalIndexReadBenchmark.java index bfc3c297526..37988598324 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IncrementalIndexReadBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IncrementalIndexReadBenchmark.java @@ -103,7 +103,7 @@ public class IncrementalIndexReadBenchmark { log.info("SETUP CALLED AT " + +System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); schemaInfo = GeneratorBasicSchemas.SCHEMA_MAP.get(schema); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexIngestionBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexIngestionBenchmark.java index 310f155432d..ddac83b44ad 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexIngestionBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexIngestionBenchmark.java @@ -86,7 +86,7 @@ public class IndexIngestionBenchmark @Setup public void setup() throws JsonProcessingException { - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); schemaInfo = GeneratorBasicSchemas.SCHEMA_MAP.get(schema); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexMergeBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexMergeBenchmark.java index b2d32cd5071..a394c1d6842 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexMergeBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexMergeBenchmark.java @@ -117,7 +117,7 @@ public class IndexMergeBenchmark log.info("SETUP CALLED AT " + System.currentTimeMillis()); indexMergerV9 = new IndexMergerV9(JSON_MAPPER, INDEX_IO, getSegmentWriteOutMediumFactory(factoryType)); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); indexesToMerge = new ArrayList<>(); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexPersistBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexPersistBenchmark.java index 5fff33d1fec..cd3dae8b26e 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexPersistBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/indexing/IndexPersistBenchmark.java @@ -107,7 +107,7 @@ public class IndexPersistBenchmark { log.info("SETUP CALLED AT " + System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); schemaInfo = GeneratorBasicSchemas.SCHEMA_MAP.get(schema); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/query/GroupByBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/query/GroupByBenchmark.java index db572c8a4fe..8fd6ca75e9f 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/query/GroupByBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/query/GroupByBenchmark.java @@ -434,7 +434,7 @@ public class GroupByBenchmark { log.info("SETUP CALLED AT " + +System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); setupQueries(); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/query/ScanBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/query/ScanBenchmark.java index 45d89f14add..76c4f036f9b 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/query/ScanBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/query/ScanBenchmark.java @@ -244,7 +244,7 @@ public class ScanBenchmark { log.info("SETUP CALLED AT " + +System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); setupQueries(); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/query/SearchBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/query/SearchBenchmark.java index e1d02758126..322a577e786 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/query/SearchBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/query/SearchBenchmark.java @@ -317,7 +317,7 @@ public class SearchBenchmark { log.info("SETUP CALLED AT " + +System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); setupQueries(); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/query/TimeseriesBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/query/TimeseriesBenchmark.java index 68625768967..ee54b17ceaa 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/query/TimeseriesBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/query/TimeseriesBenchmark.java @@ -245,7 +245,7 @@ public class TimeseriesBenchmark { log.info("SETUP CALLED AT " + System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); setupQueries(); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/query/TopNBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/query/TopNBenchmark.java index 7bced644ac7..843eae489ae 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/query/TopNBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/query/TopNBenchmark.java @@ -216,7 +216,7 @@ public class TopNBenchmark { log.info("SETUP CALLED AT " + System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); setupQueries(); diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/query/timecompare/TimeCompareBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/query/timecompare/TimeCompareBenchmark.java index cc5d12dfa67..002608cf8eb 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/query/timecompare/TimeCompareBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/query/timecompare/TimeCompareBenchmark.java @@ -285,7 +285,7 @@ public class TimeCompareBenchmark { log.info("SETUP CALLED AT " + System.currentTimeMillis()); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); executorService = Execs.multiThreaded(numSegments, "TopNThreadPool"); diff --git a/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramDruidModule.java b/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramDruidModule.java index d2bc2d2af94..64d60385d49 100644 --- a/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramDruidModule.java +++ b/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramDruidModule.java @@ -66,7 +66,7 @@ public class ApproximateHistogramDruidModule implements DruidModule @VisibleForTesting public static void registerSerde() { - ComplexMetrics.registerSerde("approximateHistogram", new ApproximateHistogramFoldingSerde()); + ComplexMetrics.registerSerde(ApproximateHistogramFoldingSerde.TYPE_NAME, new ApproximateHistogramFoldingSerde()); ComplexMetrics.registerSerde(FixedBucketsHistogramAggregator.TYPE_NAME, new FixedBucketsHistogramSerde()); } } diff --git a/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramFoldingSerde.java b/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramFoldingSerde.java index cc7cb291fbc..f606fbaf29f 100644 --- a/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramFoldingSerde.java +++ b/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramFoldingSerde.java @@ -38,10 +38,12 @@ import java.util.Collection; public class ApproximateHistogramFoldingSerde extends ComplexMetricSerde { + public static final String TYPE_NAME = "approximateHistogram"; + @Override public String getTypeName() { - return "approximateHistogram"; + return TYPE_NAME; } @Override diff --git a/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/stats/DruidStatsModule.java b/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/stats/DruidStatsModule.java index 1c0fa35503b..828b14eac0e 100644 --- a/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/stats/DruidStatsModule.java +++ b/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/stats/DruidStatsModule.java @@ -65,6 +65,6 @@ public class DruidStatsModule implements DruidModule SqlBindings.addAggregator(binder, BaseVarianceSqlAggregator.StdDevSampSqlAggregator.class); SqlBindings.addAggregator(binder, BaseVarianceSqlAggregator.StdDevSqlAggregator.class); } - ComplexMetrics.registerSerde("variance", new VarianceSerde()); + ComplexMetrics.registerSerde(VarianceSerde.TYPE_NAME, new VarianceSerde()); } } diff --git a/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/variance/VarianceSerde.java b/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/variance/VarianceSerde.java index 256e83ae051..f5c081ecfad 100644 --- a/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/variance/VarianceSerde.java +++ b/extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/variance/VarianceSerde.java @@ -38,13 +38,15 @@ import java.util.List; */ public class VarianceSerde extends ComplexMetricSerde { + public static final String TYPE_NAME = "variance"; + private static final Ordering COMPARATOR = Ordering.from(VarianceAggregatorCollector.COMPARATOR).nullsFirst(); @Override public String getTypeName() { - return "variance"; + return TYPE_NAME; } @Override diff --git a/processing/src/main/java/org/apache/druid/jackson/AggregatorsModule.java b/processing/src/main/java/org/apache/druid/jackson/AggregatorsModule.java index 9f792730506..3130fefb85d 100644 --- a/processing/src/main/java/org/apache/druid/jackson/AggregatorsModule.java +++ b/processing/src/main/java/org/apache/druid/jackson/AggregatorsModule.java @@ -79,9 +79,9 @@ public class AggregatorsModule extends SimpleModule { super("AggregatorFactories"); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); - ComplexMetrics.registerSerde("preComputedHyperUnique", new PreComputedHyperUniquesSerde()); - ComplexMetrics.registerSerde("serializablePairLongString", new SerializablePairLongStringComplexMetricSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); + ComplexMetrics.registerSerde(PreComputedHyperUniquesSerde.TYPE_NAME, new PreComputedHyperUniquesSerde()); + ComplexMetrics.registerSerde(SerializablePairLongStringComplexMetricSerde.TYPE_NAME, new SerializablePairLongStringComplexMetricSerde()); setMixInAnnotation(AggregatorFactory.class, AggregatorFactoryMixin.class); setMixInAnnotation(PostAggregator.class, PostAggregatorMixin.class); diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java b/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java index 61e80d1a869..26e3140f829 100644 --- a/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java @@ -38,6 +38,8 @@ import java.util.List; public class HyperUniquesSerde extends ComplexMetricSerde { + public static final String TYPE_NAME = "hyperUnique"; + private static Comparator comparator = Comparator.nullsFirst(Comparator.comparing(HyperLogLogCollector::toByteBuffer)); @@ -56,7 +58,7 @@ public class HyperUniquesSerde extends ComplexMetricSerde @Override public String getTypeName() { - return "hyperUnique"; + return TYPE_NAME; } @Override diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/PreComputedHyperUniquesSerde.java b/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/PreComputedHyperUniquesSerde.java index c4a49bce683..437a4baee8b 100644 --- a/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/PreComputedHyperUniquesSerde.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/PreComputedHyperUniquesSerde.java @@ -29,6 +29,8 @@ import java.nio.ByteBuffer; public class PreComputedHyperUniquesSerde extends HyperUniquesSerde { + public static final String TYPE_NAME = "preComputedHyperUnique"; + public PreComputedHyperUniquesSerde() { super(); diff --git a/processing/src/test/java/org/apache/druid/frame/write/FrameWriterTest.java b/processing/src/test/java/org/apache/druid/frame/write/FrameWriterTest.java index 78a193cb4b5..9243ceb41c5 100644 --- a/processing/src/test/java/org/apache/druid/frame/write/FrameWriterTest.java +++ b/processing/src/test/java/org/apache/druid/frame/write/FrameWriterTest.java @@ -126,7 +126,7 @@ public class FrameWriterTest extends InitializedNullHandlingTest @BeforeClass public static void setUpClass() { - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); } @Test diff --git a/processing/src/test/java/org/apache/druid/frame/write/FrameWritersTest.java b/processing/src/test/java/org/apache/druid/frame/write/FrameWritersTest.java index f7f8a11e14d..42ed468ec8c 100644 --- a/processing/src/test/java/org/apache/druid/frame/write/FrameWritersTest.java +++ b/processing/src/test/java/org/apache/druid/frame/write/FrameWritersTest.java @@ -135,7 +135,7 @@ public class FrameWritersTest extends InitializedNullHandlingTest { // Register, but don't unregister at the end of this test, because many other tests out there expect this to exist // even though they don't explicitly register it. - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); final IllegalArgumentException e = Assert.assertThrows( IllegalArgumentException.class, diff --git a/processing/src/test/java/org/apache/druid/segment/SchemalessIndexTest.java b/processing/src/test/java/org/apache/druid/segment/SchemalessIndexTest.java index f75472c9ea5..273e2596597 100644 --- a/processing/src/test/java/org/apache/druid/segment/SchemalessIndexTest.java +++ b/processing/src/test/java/org/apache/druid/segment/SchemalessIndexTest.java @@ -88,7 +88,7 @@ public class SchemalessIndexTest private static QueryableIndex mergedIndex = null; static { - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); } private final IndexMerger indexMerger; diff --git a/processing/src/test/java/org/apache/druid/segment/TestIndex.java b/processing/src/test/java/org/apache/druid/segment/TestIndex.java index 83b1e7fa636..374cf6c7e01 100644 --- a/processing/src/test/java/org/apache/druid/segment/TestIndex.java +++ b/processing/src/test/java/org/apache/druid/segment/TestIndex.java @@ -153,7 +153,7 @@ public class TestIndex public static final IndexIO INDEX_IO = TestHelper.getTestIndexIO(); static { - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); } private static Supplier realtimeIndex = Suppliers.memoize( diff --git a/processing/src/test/java/org/apache/druid/segment/generator/SegmentGenerator.java b/processing/src/test/java/org/apache/druid/segment/generator/SegmentGenerator.java index 5c03410ad1d..8f1246c7255 100644 --- a/processing/src/test/java/org/apache/druid/segment/generator/SegmentGenerator.java +++ b/processing/src/test/java/org/apache/druid/segment/generator/SegmentGenerator.java @@ -137,7 +137,7 @@ public class SegmentGenerator implements Closeable ) { // In case we need to generate hyperUniques or json - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); NestedDataModule.registerHandlersAndSerde(); final String dataHash = Hashing.sha256() @@ -260,7 +260,7 @@ public class SegmentGenerator implements Closeable ) { // In case we need to generate hyperUniques. - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); final String dataHash = Hashing.sha256() .newHasher() diff --git a/processing/src/test/java/org/apache/druid/segment/serde/ComplexMetricsTest.java b/processing/src/test/java/org/apache/druid/segment/serde/ComplexMetricsTest.java index d9e6b7ba54c..b4520d66741 100644 --- a/processing/src/test/java/org/apache/druid/segment/serde/ComplexMetricsTest.java +++ b/processing/src/test/java/org/apache/druid/segment/serde/ComplexMetricsTest.java @@ -34,9 +34,9 @@ public class ComplexMetricsTest @Test public void testRegister() { - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); - ComplexMetricSerde serde = ComplexMetrics.getSerdeForType("hyperUnique"); + ComplexMetricSerde serde = ComplexMetrics.getSerdeForType(HyperUniquesSerde.TYPE_NAME); Assert.assertNotNull(serde); Assert.assertTrue(serde instanceof HyperUniquesSerde); } @@ -44,15 +44,15 @@ public class ComplexMetricsTest @Test public void testRegisterDuplicate() { - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); - ComplexMetricSerde serde = ComplexMetrics.getSerdeForType("hyperUnique"); + ComplexMetricSerde serde = ComplexMetrics.getSerdeForType(HyperUniquesSerde.TYPE_NAME); Assert.assertNotNull(serde); Assert.assertTrue(serde instanceof HyperUniquesSerde); - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); - serde = ComplexMetrics.getSerdeForType("hyperUnique"); + serde = ComplexMetrics.getSerdeForType(HyperUniquesSerde.TYPE_NAME); Assert.assertNotNull(serde); Assert.assertTrue(serde instanceof HyperUniquesSerde); } @@ -60,18 +60,18 @@ public class ComplexMetricsTest @Test public void testConflicting() { - ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde()); - ComplexMetricSerde serde = ComplexMetrics.getSerdeForType("hyperUnique"); + ComplexMetricSerde serde = ComplexMetrics.getSerdeForType(HyperUniquesSerde.TYPE_NAME); 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.SerializablePairLongStringComplexMetricSerde], found [org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde"); - ComplexMetrics.registerSerde("hyperUnique", new SerializablePairLongStringComplexMetricSerde()); + ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new SerializablePairLongStringComplexMetricSerde()); - serde = ComplexMetrics.getSerdeForType("hyperUnique"); + serde = ComplexMetrics.getSerdeForType(HyperUniquesSerde.TYPE_NAME); Assert.assertNotNull(serde); Assert.assertTrue(serde instanceof HyperUniquesSerde); }