mirror of https://github.com/apache/druid.git
Add null check for VarianceAggregatorCollector
This commit is contained in:
parent
ddeb55fac1
commit
ddd2299272
|
@ -91,8 +91,11 @@ public class VarianceAggregatorCollector
|
|||
this.sum += other.sum;
|
||||
}
|
||||
|
||||
static Object combineValues(Object lhs, @Nullable Object rhs)
|
||||
static Object combineValues(@Nullable Object lhs, @Nullable Object rhs)
|
||||
{
|
||||
if (lhs == null) {
|
||||
return rhs;
|
||||
}
|
||||
((VarianceAggregatorCollector) lhs).fold((VarianceAggregatorCollector) rhs);
|
||||
return lhs;
|
||||
}
|
||||
|
|
|
@ -173,6 +173,14 @@ public class VarianceAggregatorCollectorTest extends InitializedNullHandlingTest
|
|||
Assert.assertEquals(0, VarianceAggregatorCollector.COMPARATOR.compare(v1, v2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullCollectors()
|
||||
{
|
||||
VarianceAggregatorCollector collector =
|
||||
(VarianceAggregatorCollector) VarianceAggregatorCollector.combineValues(null, null);
|
||||
Assert.assertNull(collector);
|
||||
}
|
||||
|
||||
private static class FloatHandOver extends TestFloatColumnSelector
|
||||
{
|
||||
float v;
|
||||
|
|
Loading…
Reference in New Issue