|
8 | 8 | CuDFSamePathExecutor, |
9 | 9 | execute_same_path_chain, |
10 | 10 | ) |
| 11 | +from graphistry.compute.gfql_unified import gfql |
11 | 12 | from graphistry.gfql.same_path_types import col, compare |
12 | 13 | from graphistry.gfql.ref.enumerator import OracleCaps, enumerate_chain |
13 | 14 | from graphistry.tests.test_compute import CGFull |
@@ -389,3 +390,27 @@ def test_cudf_gpu_path_if_available(): |
389 | 390 | assert result._nodes is not None and result._edges is not None |
390 | 391 | assert set(result._nodes["id"].to_pandas()) == {"acct1", "acct2"} |
391 | 392 | assert set(result._edges["src"].to_pandas()) == {"acct1", "acct2"} |
| 393 | + |
| 394 | + |
| 395 | +def test_dispatch_dict_where_triggers_executor(): |
| 396 | + pytest.importorskip("cudf") |
| 397 | + graph = _make_graph() |
| 398 | + query = { |
| 399 | + "chain": [ |
| 400 | + {"type": "Node", "name": "a", "filter_dict": {"type": "account"}}, |
| 401 | + {"type": "Edge", "name": "r", "direction": "forward", "hops": 1}, |
| 402 | + {"type": "Node", "name": "c", "filter_dict": {"type": "user"}}, |
| 403 | + ], |
| 404 | + "where": [{"eq": {"left": "a.owner_id", "right": "c.id"}}], |
| 405 | + } |
| 406 | + result = gfql(graph, query, engine=Engine.CUDF) |
| 407 | + oracle = enumerate_chain( |
| 408 | + graph, [n({"type": "account"}, name="a"), e_forward(name="r"), n({"type": "user"}, name="c")], |
| 409 | + where=[compare(col("a", "owner_id"), "==", col("c", "id"))], |
| 410 | + include_paths=False, |
| 411 | + caps=OracleCaps(max_nodes=20, max_edges=20), |
| 412 | + ) |
| 413 | + assert result._nodes is not None and result._edges is not None |
| 414 | + assert set(result._nodes["id"]) == set(oracle.nodes["id"]) |
| 415 | + assert set(result._edges["src"]) == set(oracle.edges["src"]) |
| 416 | + assert set(result._edges["dst"]) == set(oracle.edges["dst"]) |
0 commit comments