Hey ArcadeDB team,
I ran into an issue with the OpenCypher interpreter within ArcadeDB. When I put a CASE statement inside an aggregation function like sum() or count(), ArcadeDB accidentally uses the variable inside the CASE as a grouping key.
Instead of returning a single row for the total, it splits the results into multiple rows.
Example to reproduce:
UNWIND [{state: 'NY'}, {state: 'PA'}, {state: 'PA'}] AS loc
RETURN count(loc) AS total, sum(CASE WHEN loc.state = 'PA' THEN 1 ELSE 0 END) AS pa
What ArcadeDB returns:
It splits the result into multiple rows based on the state variable:
What I expect it return:
I tested this query on neo4j and memgraph playgrounds, and there it returns exactly one row. Because both items in the RETURN clause are aggregations and there are no stray variables, Cypher collapses it into one result:
It seems like the execution planner is peeking inside the sum() and grouping by loc.state under the hood.
ArcadeDB Version: 26.3.2
Hey ArcadeDB team,
I ran into an issue with the OpenCypher interpreter within ArcadeDB. When I put a
CASEstatement inside an aggregation function likesum()orcount(), ArcadeDB accidentally uses the variable inside the CASE as a grouping key.Instead of returning a single row for the total, it splits the results into multiple rows.
Example to reproduce:
What ArcadeDB returns:
It splits the result into multiple rows based on the state variable:
What I expect it return:
I tested this query on neo4j and memgraph playgrounds, and there it returns exactly one row. Because both items in the
RETURNclause are aggregations and there are no stray variables, Cypher collapses it into one result:It seems like the execution planner is peeking inside the
sum()and grouping byloc.stateunder the hood.ArcadeDB Version: 26.3.2