Skip to content

Commit 786170a

Browse files
committed
test(cypher): expand #1392 joined-row aggregation coverage
1 parent 4d68505 commit 786170a

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

graphistry/tests/compute/gfql/cypher/test_lowering.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12548,6 +12548,44 @@ def test_string_cypher_multi_alias_with_non_active_whole_row_aggregation_groupin
1254812548
]
1254912549

1255012550

12551+
def test_string_cypher_multi_alias_with_non_active_grouping_then_property_projection() -> None:
12552+
"""Post-grouping alias.property projections remain available after non-active whole-row grouping (#1392)."""
12553+
graph = _mk_ic4_shape_graph()
12554+
result = graph.gfql(
12555+
"MATCH (person:Person {id: $pid})-[:KNOWS]-(friend:Person), "
12556+
"(friend)<-[:HAS_CREATOR]-(post:Post)-[:HAS_TAG]->(tag:Tag) "
12557+
"WITH DISTINCT tag, post "
12558+
"WITH post, count(tag) AS tagCount "
12559+
"WITH post.id AS postId, post.creationDate AS cd, tagCount "
12560+
"RETURN postId, cd, tagCount ORDER BY postId",
12561+
params={"pid": "p1"},
12562+
)
12563+
assert result._nodes.to_dict(orient="records") == [
12564+
{"postId": "post1", "cd": 100.0, "tagCount": 1},
12565+
{"postId": "post2", "cd": 200.0, "tagCount": 1},
12566+
{"postId": "post3", "cd": 300.0, "tagCount": 1},
12567+
]
12568+
12569+
12570+
def test_string_cypher_multi_alias_with_non_active_multi_whole_row_grouping() -> None:
12571+
"""Aggregate grouping over two whole-row aliases preserves both alias key prefixes (#1392)."""
12572+
graph = _mk_ic4_shape_graph()
12573+
result = graph.gfql(
12574+
"MATCH (person:Person {id: $pid})-[:KNOWS]-(friend:Person), "
12575+
"(friend)<-[:HAS_CREATOR]-(post:Post)-[:HAS_TAG]->(tag:Tag) "
12576+
"WITH DISTINCT tag, post "
12577+
"WITH post, tag, count(*) AS cnt "
12578+
"RETURN post.id AS postId, tag.name AS tagName, cnt "
12579+
"ORDER BY postId, tagName",
12580+
params={"pid": "p1"},
12581+
)
12582+
assert result._nodes.to_dict(orient="records") == [
12583+
{"postId": "post1", "tagName": "TagA", "cnt": 1},
12584+
{"postId": "post2", "tagName": "TagA", "cnt": 1},
12585+
{"postId": "post3", "tagName": "TagB", "cnt": 1},
12586+
]
12587+
12588+
1255112589
def test_string_cypher_multi_alias_with_non_final_agg_multiple_funcs() -> None:
1255212590
"""Non-final WITH aggregate with multiple agg functions, then RETURN alias property (#1054)."""
1255312591
graph = _mk_ic4_shape_graph()

0 commit comments

Comments
 (0)