Skip to content

Commit 2e0bcae

Browse files
authored
feat: Use datafusion planner as the default execution strategy (#53)
1 parent b1d54bf commit 2e0bcae

4 files changed

Lines changed: 150 additions & 726 deletions

File tree

python/python/tests/test_graph.py

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,9 @@ def test_basic_node_selection(graph_env, execute_method):
6969
result = getattr(query, execute_method)({"Person": datasets["Person"]})
7070
data = result.to_pydict()
7171

72-
# TODO: remove this if/else statements when the execute() also returns
73-
# Cypher dot notation
74-
if execute_method == "execute":
75-
# execute() returns unqualified names for simple queries
76-
assert set(data.keys()) == {"name", "age"}
77-
assert len(data["name"]) == 4
78-
assert "Alice" in set(data["name"])
79-
else:
80-
# execute_datafusion() returns Cypher dot notation
81-
assert set(data.keys()) == {"p.name", "p.age"}
82-
assert len(data["p.name"]) == 4
83-
assert "Alice" in set(data["p.name"])
72+
assert set(data.keys()) == {"p.name", "p.age"}
73+
assert len(data["p.name"]) == 4
74+
assert "Alice" in set(data["p.name"])
8475

8576

8677
@pytest.mark.parametrize("execute_method", ["execute", "execute_datafusion"])
@@ -92,14 +83,9 @@ def test_filtered_query(graph_env, execute_method):
9283
result = getattr(query, execute_method)({"Person": datasets["Person"]})
9384
data = result.to_pydict()
9485

95-
if execute_method == "execute":
96-
assert len(data["name"]) == 2
97-
assert set(data["name"]) == {"Bob", "David"}
98-
assert all(age > 30 for age in data["age"])
99-
else:
100-
assert len(data["p.name"]) == 2
101-
assert set(data["p.name"]) == {"Bob", "David"}
102-
assert all(age > 30 for age in data["p.age"])
86+
assert len(data["p.name"]) == 2
87+
assert set(data["p.name"]) == {"Bob", "David"}
88+
assert all(age > 30 for age in data["p.age"])
10389

10490

10591
@pytest.mark.parametrize("execute_method", ["execute", "execute_datafusion"])
@@ -209,11 +195,5 @@ def test_distinct_clause(graph_env, execute_method):
209195
)
210196
data = result.to_pydict()
211197

212-
if execute_method == "execute":
213-
# execute() returns qualified column names for relationship queries
214-
assert len(data["c__company_name"]) == 3
215-
assert set(data["c__company_name"]) == {"TechCorp", "DataInc", "CloudSoft"}
216-
else:
217-
# execute_datafusion() returns Cypher dot notation
218-
assert len(data["c.company_name"]) == 3
219-
assert set(data["c.company_name"]) == {"TechCorp", "DataInc", "CloudSoft"}
198+
assert len(data["c.company_name"]) == 3
199+
assert set(data["c.company_name"]) == {"TechCorp", "DataInc", "CloudSoft"}

python/python/tests/test_knowledge_graph_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_build_graph_config_from_mapping_supports_simple_nodes():
2121
.execute({"Person": table})
2222
.to_pydict()
2323
)
24-
assert data["person_id"] == [1, 2]
24+
assert data["id"] == [1, 2]
2525

2626

2727
def test_build_graph_config_from_mapping_requires_id_field():

0 commit comments

Comments
 (0)