Fix serde for ArrayOfDoublesSketchConstantPostAggregator. (#16550)

* Fix serde for ArrayOfDoublesSketchConstantPostAggregator.

The version originally added in #13819 was missing an annotation for
the "value" property. Fixes #16539.

Line endings for ArrayOfDoublesSketchConstantPostAggregator.java are changed
from \r\n to \n.

Adds a serde test, and improves various other datasketches post-aggregator
serde tests to deserialize into PostAggregator. This verifies that the type
information is set up correctly.

* Fix excessive imports.

* Fix equals, hashCode.
This commit is contained in:
Gian Merlino 2024-06-05 20:01:51 -07:00 committed by GitHub
parent b837ce565b
commit 2534a42539
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 260 additions and 203 deletions

View File

@ -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<String> getDependentFields()
{
return Collections.emptySet();
}
@Override
public Comparator getComparator()
{
return Comparators.alwaysEqual();
}
@Override
public Object compute(Map<String, Object> combinedAggregators)
{
return sketchValue;
}
@Override
public ArrayOfDoublesSketchConstantPostAggregator decorate(Map<String, AggregatorFactory> 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<String> getDependentFields()
{
return Collections.emptySet();
}
@Override
public Comparator getComparator()
{
return Comparators.alwaysEqual();
}
@Override
public Object compute(Map<String, Object> combinedAggregators)
{
return sketchValue;
}
@Override
public ArrayOfDoublesSketchConstantPostAggregator decorate(Map<String, AggregatorFactory> 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();
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -85,11 +85,13 @@ public class SketchSetPostAggregatorTest
);
List<PostAggregator> 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);

View File

@ -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);

View File

@ -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();
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);