mirror of https://github.com/apache/druid.git
Fix equals for ArrayOfDoublesSketchAggregatorFactory (#8326)
This commit is contained in:
parent
399b3ad7de
commit
b654096194
|
@ -323,7 +323,7 @@ public class ArrayOfDoublesSketchAggregatorFactory extends AggregatorFactory
|
||||||
if (!Objects.equals(metricColumns, that.metricColumns)) {
|
if (!Objects.equals(metricColumns, that.metricColumns)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return numberOfValues != that.numberOfValues;
|
return numberOfValues == that.numberOfValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.apache.druid.query.aggregation.datasketches.tuple;
|
package org.apache.druid.query.aggregation.datasketches.tuple;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.yahoo.sketches.tuple.ArrayOfDoublesSketch;
|
import com.yahoo.sketches.tuple.ArrayOfDoublesSketch;
|
||||||
import com.yahoo.sketches.tuple.ArrayOfDoublesUpdatableSketch;
|
import com.yahoo.sketches.tuple.ArrayOfDoublesUpdatableSketch;
|
||||||
import com.yahoo.sketches.tuple.ArrayOfDoublesUpdatableSketchBuilder;
|
import com.yahoo.sketches.tuple.ArrayOfDoublesUpdatableSketchBuilder;
|
||||||
|
@ -55,4 +56,24 @@ public class ArrayOfDoublesSketchAggregatorFactoryTest
|
||||||
Assert.assertEquals(3, combiner.getObject().getEstimate(), 0);
|
Assert.assertEquals(3, combiner.getObject().getEstimate(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEquals()
|
||||||
|
{
|
||||||
|
final ArrayOfDoublesSketchAggregatorFactory a1 = new ArrayOfDoublesSketchAggregatorFactory(
|
||||||
|
"name",
|
||||||
|
"field",
|
||||||
|
1,
|
||||||
|
ImmutableList.of("met"),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
final ArrayOfDoublesSketchAggregatorFactory a2 = new ArrayOfDoublesSketchAggregatorFactory(
|
||||||
|
"name",
|
||||||
|
"field",
|
||||||
|
1,
|
||||||
|
ImmutableList.of("met"),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
Assert.assertEquals(a1, a2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue