aplbrain / aplbrain/grand-cypher
mixing return of both groupby and value should not allowed
- 主要语言
- Python
- 星标
- 129
- 派生
- 17
- PR 合并指标
- PR 指标待抓取
描述
The current implementation allows GroupBy of a value with the value itself
```python
def test_alias_with_order_by(self):
host = nx.MultiDiGraph()
host.add_node("a", name="Alice", age=25)
host.add_node("b", name="Bob", age=30)
host.add_node("c", name="Carol", age=20)
host.add_edge("b", "a", __labels__={"paid"}, value=14)
host.add_edge("a", "b", __labels__={"paid"}, value=9)
host.add_edge("a", "b", __labels__={"paid"}, amount=96)
host.add_edge("a", "b", __labels__={"paid"}, value=40)
qry = """
MATCH (n)-[r]->(m)
RETURN n.name, AVG(r.value) AS average, m.name, r.value
ORDER BY average ASC
"""
res = GrandCypher(host).run(qry)
assert res["n.name"] == ["Bob", "Alice"]
assert res["m.name"] == ["Alice", "Bob"]
assert res["r.value"] == [
{(0, "paid"): 14},
{(0, "paid"): 9, (1, "paid"): None, (2, "paid"): 40},
]
assert res["average"] == [{"paid": 14.0}, {"paid": 16.333333333333332}]
```
I think this should not be allowed `RETURN n.name, AVG(r.value) AS average, m.name, r.value`. This should be achieved with another aggregation function called `COLLECT`
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。