mirror of https://github.com/apache/druid.git
Fix two alerts from lgtm.com: comparing two boxed primitive values using (#4212)
the == or != operator compares object identity, which may not be intended Details:013566ade9/files/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java (V144)
013566ade9/files/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchMergeAggregatorFactory.java (V164)
This commit is contained in:
parent
52f7bb091d
commit
54463941b9
|
@ -141,9 +141,18 @@ public class SketchEstimatePostAggregator implements PostAggregator
|
|||
if (!name.equals(that.name)) {
|
||||
return false;
|
||||
}
|
||||
if (errorBoundsStdDev != that.errorBoundsStdDev) {
|
||||
|
||||
if (errorBoundsStdDev == null ^ that.errorBoundsStdDev == null) {
|
||||
// one of the two stddevs (not both) are null
|
||||
return false;
|
||||
}
|
||||
|
||||
if (errorBoundsStdDev != null && that.errorBoundsStdDev != null &&
|
||||
errorBoundsStdDev.intValue() != that.errorBoundsStdDev.intValue()) {
|
||||
// neither stddevs are null, Integer values don't match
|
||||
return false;
|
||||
}
|
||||
|
||||
return field.equals(that.field);
|
||||
|
||||
}
|
||||
|
|
|
@ -161,11 +161,19 @@ public class SketchMergeAggregatorFactory extends SketchAggregatorFactory
|
|||
if (shouldFinalize != that.shouldFinalize) {
|
||||
return false;
|
||||
}
|
||||
if (errorBoundsStdDev != that.errorBoundsStdDev) {
|
||||
|
||||
if (errorBoundsStdDev == null ^ that.errorBoundsStdDev == null) {
|
||||
// one of the two stddevs (not both) are null
|
||||
return false;
|
||||
}
|
||||
return isInputThetaSketch == that.isInputThetaSketch;
|
||||
|
||||
if (errorBoundsStdDev != null && that.errorBoundsStdDev != null &&
|
||||
errorBoundsStdDev.intValue() != that.errorBoundsStdDev.intValue()) {
|
||||
// neither stddevs are null, Integer values don't match
|
||||
return false;
|
||||
}
|
||||
|
||||
return isInputThetaSketch == that.isInputThetaSketch;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue