|
9 | 9 | execute_same_path_chain, |
10 | 10 | ) |
11 | 11 | from graphistry.compute.gfql_unified import gfql |
| 12 | +from graphistry.compute.chain import Chain |
12 | 13 | from graphistry.gfql.same_path_types import col, compare |
13 | 14 | from graphistry.gfql.ref.enumerator import OracleCaps, enumerate_chain |
14 | 15 | from graphistry.tests.test_compute import CGFull |
@@ -414,3 +415,27 @@ def test_dispatch_dict_where_triggers_executor(): |
414 | 415 | assert set(result._nodes["id"]) == set(oracle.nodes["id"]) |
415 | 416 | assert set(result._edges["src"]) == set(oracle.edges["src"]) |
416 | 417 | assert set(result._edges["dst"]) == set(oracle.edges["dst"]) |
| 418 | + |
| 419 | + |
| 420 | +def test_dispatch_chain_list_and_single_ast(): |
| 421 | + graph = _make_graph() |
| 422 | + chain_ops = [ |
| 423 | + n({"type": "account"}, name="a"), |
| 424 | + e_forward(name="r"), |
| 425 | + n({"type": "user"}, name="c"), |
| 426 | + ] |
| 427 | + where = [compare(col("a", "owner_id"), "==", col("c", "id"))] |
| 428 | + |
| 429 | + for query in [Chain(chain_ops, where=where), chain_ops]: |
| 430 | + result = gfql(graph, query, engine=Engine.PANDAS) |
| 431 | + oracle = enumerate_chain( |
| 432 | + graph, |
| 433 | + chain_ops if isinstance(query, list) else list(chain_ops), |
| 434 | + where=where, |
| 435 | + include_paths=False, |
| 436 | + caps=OracleCaps(max_nodes=20, max_edges=20), |
| 437 | + ) |
| 438 | + assert result._nodes is not None and result._edges is not None |
| 439 | + assert set(result._nodes["id"]) == set(oracle.nodes["id"]) |
| 440 | + assert set(result._edges["src"]) == set(oracle.edges["src"]) |
| 441 | + assert set(result._edges["dst"]) == set(oracle.edges["dst"]) |
0 commit comments