Compare commits

...

1 Commits

Author SHA1 Message Date
Sinisa
d6ed893035 fix for sum(null) 2022-02-25 15:40:58 +00:00
2 changed files with 3 additions and 3 deletions

View File

@@ -2599,8 +2599,8 @@ namespace {
TypedValue DefaultAggregationOpValue(const Aggregate::Element &element, utils::MemoryResource *memory) { TypedValue DefaultAggregationOpValue(const Aggregate::Element &element, utils::MemoryResource *memory) {
switch (element.op) { switch (element.op) {
case Aggregation::Op::COUNT: case Aggregation::Op::COUNT:
return TypedValue(0, memory);
case Aggregation::Op::SUM: case Aggregation::Op::SUM:
return TypedValue(0, memory);
case Aggregation::Op::MIN: case Aggregation::Op::MIN:
case Aggregation::Op::MAX: case Aggregation::Op::MAX:
case Aggregation::Op::AVG: case Aggregation::Op::AVG:

View File

@@ -1,4 +1,4 @@
// Copyright 2021 Memgraph Ltd. // Copyright 2022 Memgraph Ltd.
// //
// Use of this software is governed by the Business Source License // Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@@ -260,7 +260,7 @@ TEST_F(QueryPlanAggregateOps, WithoutDataWithoutGroupBy) {
// max // max
EXPECT_TRUE(results[0][3].IsNull()); EXPECT_TRUE(results[0][3].IsNull());
// sum // sum
EXPECT_TRUE(results[0][4].IsNull()); EXPECT_EQ(results[0][4].ValueInt(), 0);
// avg // avg
EXPECT_TRUE(results[0][5].IsNull()); EXPECT_TRUE(results[0][5].IsNull());
// collect list // collect list