An aggregate element's input expression can be NULL
Summary: For example, the aggregate element produced for `COUNT(*)` has its `value` set to `NULL`. Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2463
This commit is contained in:
parent
d385ebfa15
commit
5c5c926515
@ -357,7 +357,9 @@ json ToJson(const EdgeCreationInfo &edge_info, const DbAccessor &dba) {
|
||||
|
||||
json ToJson(const Aggregate::Element &elem) {
|
||||
json json;
|
||||
json["value"] = ToJson(elem.value);
|
||||
if (elem.value) {
|
||||
json["value"] = ToJson(elem.value);
|
||||
}
|
||||
if (elem.key) {
|
||||
json["key"] = ToJson(elem.key);
|
||||
}
|
||||
|
@ -672,7 +672,8 @@ TEST_F(PrintToJsonTest, Aggregate) {
|
||||
{PROPERTY_LOOKUP("node", value), nullptr, Aggregation::Op::SUM,
|
||||
GetSymbol("sum")},
|
||||
{PROPERTY_LOOKUP("node", value), PROPERTY_LOOKUP("node", color),
|
||||
Aggregation::Op::COLLECT_MAP, GetSymbol("map")}},
|
||||
Aggregation::Op::COLLECT_MAP, GetSymbol("map")},
|
||||
{nullptr, nullptr, Aggregation::Op::COUNT, GetSymbol("count")}},
|
||||
std::vector<Expression *>{PROPERTY_LOOKUP("node", type)},
|
||||
std::vector<Symbol>{node_sym});
|
||||
|
||||
@ -690,6 +691,10 @@ TEST_F(PrintToJsonTest, Aggregate) {
|
||||
"key" : "(PropertyLookup (Identifier \"node\") \"color\")",
|
||||
"op" : "collect",
|
||||
"output_symbol" : "map"
|
||||
},
|
||||
{
|
||||
"op": "count",
|
||||
"output_symbol": "count"
|
||||
}
|
||||
],
|
||||
"group_by" : [
|
||||
|
Loading…
Reference in New Issue
Block a user