diff --git a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregator.java b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregator.java index de65a3c1bf3..7cbf0b1a110 100755 --- a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregator.java +++ b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregator.java @@ -1,129 +1,129 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - -package org.apache.druid.query.aggregation.datasketches.tuple; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.Preconditions; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.datasketches.tuple.arrayofdoubles.ArrayOfDoublesSketch; -import org.apache.druid.java.util.common.guava.Comparators; -import org.apache.druid.query.aggregation.AggregatorFactory; -import org.apache.druid.query.aggregation.AggregatorUtil; -import org.apache.druid.query.cache.CacheKeyBuilder; - -import java.util.Collections; -import java.util.Comparator; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -/** - * This post-aggregator converts a given Base64 encoded string to an ArrayOfDoublesSketch. - * The input column contains name of post-aggregator output and base64 encoded input string. - * The output is a deserialized {@link ArrayOfDoublesSketch} . - */ -public class ArrayOfDoublesSketchConstantPostAggregator extends ArrayOfDoublesSketchPostAggregator -{ - - private final String value; - private final ArrayOfDoublesSketch sketchValue; - - @JsonCreator - public ArrayOfDoublesSketchConstantPostAggregator(@JsonProperty("name") String name, @JsonProperty("value") String value) - { - super(name); - Preconditions.checkArgument(value != null && !value.isEmpty(), - "Constant value cannot be null or empty, expecting base64 encoded sketch string"); - this.value = value; - this.sketchValue = ArrayOfDoublesSketchOperations.deserializeFromBase64EncodedStringSafe(value); - } - - @Override - public Set getDependentFields() - { - return Collections.emptySet(); - } - - @Override - public Comparator getComparator() - { - return Comparators.alwaysEqual(); - } - - @Override - public Object compute(Map combinedAggregators) - { - return sketchValue; - } - - @Override - public ArrayOfDoublesSketchConstantPostAggregator decorate(Map aggregators) - { - return this; - } - - public ArrayOfDoublesSketch getSketchValue() - { - return sketchValue; - } - - @Override - public String toString() - { - return "ArrayOfDoublesSketchConstantPostAggregator{name='" + this.getName() + "', value='" + value + "'}"; - } - - private String getRawSketchValue() - { - return value; - } - - @Override - public boolean equals(Object o) - { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArrayOfDoublesSketchConstantPostAggregator that = (ArrayOfDoublesSketchConstantPostAggregator) o; - if (!(Objects.equals(this.getName(), that.getName()) && Objects.equals(this.value, that.value) - && Objects.equals(this.getSketchValue(), that.getSketchValue()))) { - return false; - } - return true; - } - - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), value, sketchValue); - } - - @Override - public byte[] getCacheKey() - { - return new CacheKeyBuilder(AggregatorUtil.ARRAY_OF_DOUBLES_SKETCH_CONSTANT_SKETCH_CACHE_TYPE_ID) - .appendString(DigestUtils.sha1Hex(value)).build(); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package org.apache.druid.query.aggregation.datasketches.tuple; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.Preconditions; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.datasketches.tuple.arrayofdoubles.ArrayOfDoublesSketch; +import org.apache.druid.java.util.common.guava.Comparators; +import org.apache.druid.query.aggregation.AggregatorFactory; +import org.apache.druid.query.aggregation.AggregatorUtil; +import org.apache.druid.query.cache.CacheKeyBuilder; + +import java.util.Collections; +import java.util.Comparator; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * This post-aggregator converts a given Base64 encoded string to an ArrayOfDoublesSketch. + * The input column contains name of post-aggregator output and base64 encoded input string. + * The output is a deserialized {@link ArrayOfDoublesSketch} . + */ +public class ArrayOfDoublesSketchConstantPostAggregator extends ArrayOfDoublesSketchPostAggregator +{ + + private final String value; + private final ArrayOfDoublesSketch sketchValue; + + @JsonCreator + public ArrayOfDoublesSketchConstantPostAggregator(@JsonProperty("name") String name, @JsonProperty("value") String value) + { + super(name); + Preconditions.checkArgument(value != null && !value.isEmpty(), + "Constant value cannot be null or empty, expecting base64 encoded sketch string"); + this.value = value; + this.sketchValue = ArrayOfDoublesSketchOperations.deserializeFromBase64EncodedStringSafe(value); + } + + @Override + public Set getDependentFields() + { + return Collections.emptySet(); + } + + @Override + public Comparator getComparator() + { + return Comparators.alwaysEqual(); + } + + @Override + public Object compute(Map combinedAggregators) + { + return sketchValue; + } + + @Override + public ArrayOfDoublesSketchConstantPostAggregator decorate(Map aggregators) + { + return this; + } + + public ArrayOfDoublesSketch getSketchValue() + { + return sketchValue; + } + + @Override + public String toString() + { + return "ArrayOfDoublesSketchConstantPostAggregator{name='" + this.getName() + "', value='" + value + "'}"; + } + + @JsonProperty("value") + private String getRawSketchValue() + { + return value; + } + + @Override + public boolean equals(Object o) + { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + ArrayOfDoublesSketchConstantPostAggregator that = (ArrayOfDoublesSketchConstantPostAggregator) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() + { + return Objects.hash(super.hashCode(), value); + } + + @Override + public byte[] getCacheKey() + { + return new CacheKeyBuilder(AggregatorUtil.ARRAY_OF_DOUBLES_SKETCH_CONSTANT_SKETCH_CACHE_TYPE_ID) + .appendString(DigestUtils.sha1Hex(value)).build(); + } +} diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimatePostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimatePostAggregatorTest.java index f84e318fb04..45eb464922d 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimatePostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimatePostAggregatorTest.java @@ -45,9 +45,10 @@ public class HllSketchToEstimatePostAggregatorTest true ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - HllSketchToEstimatePostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new HllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - HllSketchToEstimatePostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimateWithBoundsPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimateWithBoundsPostAggregatorTest.java index b2ab94e36df..aaa0fb4bb59 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimateWithBoundsPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimateWithBoundsPostAggregatorTest.java @@ -38,9 +38,10 @@ public class HllSketchToEstimateWithBoundsPostAggregatorTest 2 ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - HllSketchToEstimateWithBoundsPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new HllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - HllSketchToEstimateWithBoundsPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToStringPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToStringPostAggregatorTest.java index e8396322f26..39c3ab88255 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToStringPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToStringPostAggregatorTest.java @@ -37,9 +37,10 @@ public class HllSketchToStringPostAggregatorTest new FieldAccessPostAggregator("field1", "sketch") ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - HllSketchToStringPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new HllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - HllSketchToStringPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchUnionPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchUnionPostAggregatorTest.java index c3e72701578..29fdad46301 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchUnionPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchUnionPostAggregatorTest.java @@ -45,9 +45,10 @@ public class HllSketchUnionPostAggregatorTest TgtHllType.HLL_8.name() ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - HllSketchUnionPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new HllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - HllSketchUnionPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToCDFPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToCDFPostAggregatorTest.java index 52db8e3acae..9b57d0a4b31 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToCDFPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToCDFPostAggregatorTest.java @@ -55,9 +55,10 @@ public class KllDoublesSketchToCDFPostAggregatorTest new double[]{0.25, 0.75} ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllDoublesSketchToCDFPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllDoublesSketchToCDFPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToHistogramPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToHistogramPostAggregatorTest.java index bfb125b42b5..3b16710d065 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToHistogramPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToHistogramPostAggregatorTest.java @@ -56,9 +56,10 @@ public class KllDoublesSketchToHistogramPostAggregatorTest null ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllDoublesSketchToHistogramPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllDoublesSketchToHistogramPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilePostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilePostAggregatorTest.java index d130a1aabe5..7b8eebb8c03 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilePostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilePostAggregatorTest.java @@ -38,9 +38,10 @@ public class KllDoublesSketchToQuantilePostAggregatorTest 0.5 ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllDoublesSketchToQuantilePostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllDoublesSketchToQuantilePostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilesPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilesPostAggregatorTest.java index ff8d1985f0b..74fe1cec1de 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilesPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilesPostAggregatorTest.java @@ -55,9 +55,10 @@ public class KllDoublesSketchToQuantilesPostAggregatorTest new double[] {0, 0.5, 1} ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllDoublesSketchToQuantilesPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllDoublesSketchToQuantilesPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToRankPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToRankPostAggregatorTest.java index 0fcc98c7842..fc30398c215 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToRankPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToRankPostAggregatorTest.java @@ -49,9 +49,10 @@ public class KllDoublesSketchToRankPostAggregatorTest 0 ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllDoublesSketchToRankPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllDoublesSketchToRankPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToStringPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToStringPostAggregatorTest.java index 7c4a908248f..fc73d043e9d 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToStringPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToStringPostAggregatorTest.java @@ -43,9 +43,10 @@ public class KllDoublesSketchToStringPostAggregatorTest new FieldAccessPostAggregator("field1", "sketch") ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllDoublesSketchToStringPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllDoublesSketchToStringPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToCDFPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToCDFPostAggregatorTest.java index 33fc8f59597..ef0a4df3d5c 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToCDFPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToCDFPostAggregatorTest.java @@ -55,9 +55,10 @@ public class KllFloatsSketchToCDFPostAggregatorTest new float[]{0.25f, 0.75f} ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllFloatsSketchToCDFPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllFloatsSketchToCDFPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToHistogramPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToHistogramPostAggregatorTest.java index bf5862bec88..3a5121fba3e 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToHistogramPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToHistogramPostAggregatorTest.java @@ -56,9 +56,10 @@ public class KllFloatsSketchToHistogramPostAggregatorTest null ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllFloatsSketchToHistogramPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllFloatsSketchToHistogramPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilePostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilePostAggregatorTest.java index 1ca8b89f3b3..c331fb1b492 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilePostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilePostAggregatorTest.java @@ -38,9 +38,10 @@ public class KllFloatsSketchToQuantilePostAggregatorTest 0.5 ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllFloatsSketchToQuantilePostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllFloatsSketchToQuantilePostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilesPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilesPostAggregatorTest.java index 6f4724bc970..36eb2a13c17 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilesPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilesPostAggregatorTest.java @@ -55,9 +55,10 @@ public class KllFloatsSketchToQuantilesPostAggregatorTest new double[] {0, 0.5, 1} ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllFloatsSketchToQuantilesPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllFloatsSketchToQuantilesPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToRankPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToRankPostAggregatorTest.java index d74397eaa6e..8be7bedd4b0 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToRankPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToRankPostAggregatorTest.java @@ -49,9 +49,10 @@ public class KllFloatsSketchToRankPostAggregatorTest 0 ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllFloatsSketchToRankPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllFloatsSketchToRankPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToStringPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToStringPostAggregatorTest.java index 0d8a8f54e2c..a25f1b3c47c 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToStringPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToStringPostAggregatorTest.java @@ -43,9 +43,10 @@ public class KllFloatsSketchToStringPostAggregatorTest new FieldAccessPostAggregator("field1", "sketch") ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - KllFloatsSketchToStringPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new KllSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - KllFloatsSketchToStringPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToCDFPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToCDFPostAggregatorTest.java index e204c247934..1012044a287 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToCDFPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToCDFPostAggregatorTest.java @@ -55,9 +55,10 @@ public class DoublesSketchToCDFPostAggregatorTest new double[]{0.25, 0.75} ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - DoublesSketchToCDFPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new DoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - DoublesSketchToCDFPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToHistogramPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToHistogramPostAggregatorTest.java index 94bc7fa1b9d..4fbee3030f4 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToHistogramPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToHistogramPostAggregatorTest.java @@ -56,9 +56,10 @@ public class DoublesSketchToHistogramPostAggregatorTest null ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - DoublesSketchToHistogramPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new DoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - DoublesSketchToHistogramPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilePostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilePostAggregatorTest.java index e67b9c1e164..ece52999953 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilePostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilePostAggregatorTest.java @@ -38,9 +38,10 @@ public class DoublesSketchToQuantilePostAggregatorTest 0.5 ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - DoublesSketchToQuantilePostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new DoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - DoublesSketchToQuantilePostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilesPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilesPostAggregatorTest.java index 44648977a62..9f5ae249c35 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilesPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilesPostAggregatorTest.java @@ -55,9 +55,10 @@ public class DoublesSketchToQuantilesPostAggregatorTest new double[] {0, 0.5, 1} ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - DoublesSketchToQuantilesPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new DoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - DoublesSketchToQuantilesPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToRankPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToRankPostAggregatorTest.java index d672b2abf59..f6be85d5593 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToRankPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToRankPostAggregatorTest.java @@ -49,9 +49,10 @@ public class DoublesSketchToRankPostAggregatorTest 0 ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - DoublesSketchToRankPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new DoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - DoublesSketchToRankPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToStringPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToStringPostAggregatorTest.java index 8a7cd8d8446..e1f1cfb290c 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToStringPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToStringPostAggregatorTest.java @@ -43,9 +43,10 @@ public class DoublesSketchToStringPostAggregatorTest new FieldAccessPostAggregator("field1", "sketch") ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - DoublesSketchToStringPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new DoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - DoublesSketchToStringPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchSetPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchSetPostAggregatorTest.java index 2d502006fe4..0afda3532b6 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchSetPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchSetPostAggregatorTest.java @@ -85,11 +85,13 @@ public class SketchSetPostAggregatorTest ); List serdeTests = Arrays.asList(union, intersect, not); + DefaultObjectMapper mapper = new DefaultObjectMapper(); + mapper.registerModules(new SketchModule().getJacksonModules()); + for (PostAggregator there : serdeTests) { - DefaultObjectMapper mapper = new DefaultObjectMapper(); - SketchSetPostAggregator andBackAgain = mapper.readValue( + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - SketchSetPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchToStringPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchToStringPostAggregatorTest.java index f2d19af813d..bd3d56369ab 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchToStringPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchToStringPostAggregatorTest.java @@ -47,9 +47,10 @@ public class SketchToStringPostAggregatorTest new FieldAccessPostAggregator("field", "sketch") ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - SketchToStringPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new SketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - SketchToStringPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregatorTest.java index 9938a0e22e2..0959bbaa632 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregatorTest.java @@ -19,7 +19,9 @@ package org.apache.druid.query.aggregation.datasketches.tuple; +import com.fasterxml.jackson.core.JsonProcessingException; import nl.jqno.equalsverifier.EqualsVerifier; +import org.apache.druid.jackson.DefaultObjectMapper; import org.apache.druid.java.util.common.guava.Comparators; import org.apache.druid.query.aggregation.PostAggregator; import org.junit.Assert; @@ -28,7 +30,6 @@ import org.junit.Test; public class ArrayOfDoublesSketchConstantPostAggregatorTest { - @Test public void testSketchValue() { @@ -66,12 +67,32 @@ public class ArrayOfDoublesSketchConstantPostAggregatorTest Assert.assertEquals(Comparators.alwaysEqual(), postAgg.getComparator()); } + @Test + public void testSerde() throws JsonProcessingException + { + final PostAggregator there = new ArrayOfDoublesSketchConstantPostAggregator( + "p", + "AQEJAwgBzJP/////////fwIAAAAAAAAAzT6NGdX0aWUOJvS5EIhpLwAAAAAAAAAAAAAAAAAAAAA=" + ); + DefaultObjectMapper mapper = new DefaultObjectMapper(); + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( + mapper.writeValueAsString(there), + PostAggregator.class + ); + + Assert.assertEquals(there, andBackAgain); + Assert.assertArrayEquals(there.getCacheKey(), andBackAgain.getCacheKey()); + } + @Test public void testEqualsAndHashCode() { EqualsVerifier.forClass(ArrayOfDoublesSketchConstantPostAggregator.class) - .usingGetClass() - .verify(); + .usingGetClass() + .withNonnullFields("name") + .withIgnoredFields("sketchValue") + .verify(); } } diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchSetOpPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchSetOpPostAggregatorTest.java index 246cf910cb0..43cea2e59e6 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchSetOpPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchSetOpPostAggregatorTest.java @@ -76,9 +76,10 @@ public class ArrayOfDoublesSketchSetOpPostAggregatorTest Arrays.asList(new ConstantPostAggregator("", 0), new ConstantPostAggregator("", 0)) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchSetOpPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchSetOpPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchTTestPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchTTestPostAggregatorTest.java index c449fcf0d69..64ee4870bf5 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchTTestPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchTTestPostAggregatorTest.java @@ -84,9 +84,10 @@ public class ArrayOfDoublesSketchTTestPostAggregatorTest Arrays.asList(new ConstantPostAggregator("", 0), new ConstantPostAggregator("", 0)) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchTTestPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchTTestPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToBase64StringPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToBase64StringPostAggregatorTest.java index ed017280fd6..72c6bb63840 100755 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToBase64StringPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToBase64StringPostAggregatorTest.java @@ -51,9 +51,10 @@ public class ArrayOfDoublesSketchToBase64StringPostAggregatorTest new ConstantPostAggregator("", 0) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToBase64StringPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToBase64StringPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimateAndBoundsPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimateAndBoundsPostAggregatorTest.java index 9794e4e01ea..7ab27e3b9d9 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimateAndBoundsPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimateAndBoundsPostAggregatorTest.java @@ -44,9 +44,10 @@ public class ArrayOfDoublesSketchToEstimateAndBoundsPostAggregatorTest null ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimatePostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimatePostAggregatorTest.java index 549323435cc..99c01f2daea 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimatePostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimatePostAggregatorTest.java @@ -50,9 +50,10 @@ public class ArrayOfDoublesSketchToEstimatePostAggregatorTest new ConstantPostAggregator("", 0) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToEstimatePostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToEstimatePostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToMeansPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToMeansPostAggregatorTest.java index 2ccc7b19690..ecc0aeec346 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToMeansPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToMeansPostAggregatorTest.java @@ -50,9 +50,10 @@ public class ArrayOfDoublesSketchToMeansPostAggregatorTest new ConstantPostAggregator("", 0) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToMeansPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToMeansPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToMetricsSumEstimatePostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToMetricsSumEstimatePostAggregatorTest.java index 7a0d75d211a..dab2426511d 100755 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToMetricsSumEstimatePostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToMetricsSumEstimatePostAggregatorTest.java @@ -52,9 +52,10 @@ public class ArrayOfDoublesSketchToMetricsSumEstimatePostAggregatorTest new ConstantPostAggregator("", 0) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToMetricsSumEstimatePostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToMetricsSumEstimatePostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToNumEntriesPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToNumEntriesPostAggregatorTest.java index e98d444f1d5..270f47c5487 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToNumEntriesPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToNumEntriesPostAggregatorTest.java @@ -50,9 +50,10 @@ public class ArrayOfDoublesSketchToNumEntriesPostAggregatorTest new ConstantPostAggregator("", 0) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToNumEntriesPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToNumEntriesPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToQuantilesSketchPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToQuantilesSketchPostAggregatorTest.java index c09f9b81f01..7bd6732e240 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToQuantilesSketchPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToQuantilesSketchPostAggregatorTest.java @@ -54,9 +54,10 @@ public class ArrayOfDoublesSketchToQuantilesSketchPostAggregatorTest null ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToQuantilesSketchPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToQuantilesSketchPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToStringPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToStringPostAggregatorTest.java index fdce882ebe6..91b5452eb82 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToStringPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToStringPostAggregatorTest.java @@ -50,9 +50,10 @@ public class ArrayOfDoublesSketchToStringPostAggregatorTest new ConstantPostAggregator("", 0) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToStringPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToStringPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain); diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToVariancesPostAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToVariancesPostAggregatorTest.java index 4f42e46103d..9e63ba3385c 100644 --- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToVariancesPostAggregatorTest.java +++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToVariancesPostAggregatorTest.java @@ -50,9 +50,10 @@ public class ArrayOfDoublesSketchToVariancesPostAggregatorTest new ConstantPostAggregator("", 0) ); DefaultObjectMapper mapper = new DefaultObjectMapper(); - ArrayOfDoublesSketchToVariancesPostAggregator andBackAgain = mapper.readValue( + mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules()); + PostAggregator andBackAgain = mapper.readValue( mapper.writeValueAsString(there), - ArrayOfDoublesSketchToVariancesPostAggregator.class + PostAggregator.class ); Assert.assertEquals(there, andBackAgain);