Skip to content

Commit 34fb4f5

Browse files
beinanclaude
andauthored
refactor: remove Simple executor implementation (#147)
## Summary Removes the legacy Simple executor to simplify the codebase and reduce maintenance burden. All queries now use the DataFusion planner, which provides better performance and more features. ## Changes ### Deleted (7 files, 724 lines) - `simple_executor/` module (5 files) - `test_simple_executor_pipeline.rs` test file ### Modified (5 files) - **query.rs**: Removed Simple variant, `execute_simple()` method, and related code (~250 lines) - **lib.rs**: Removed module declaration - **graph.rs** (Python): Removed Simple from ExecutionStrategy enum - **README.md**: Updated documentation to remove Simple references - **graph_execution.rs** (benchmarks): Updated to use DataFusion ## Breaking Changes **Rust API:** - ❌ Removed `ExecutionStrategy::Simple` enum variant - ❌ Removed `CypherQuery::execute_simple()` method - ✅ Migration: Use `None` or `Some(ExecutionStrategy::DataFusion)` **Python API:** - ❌ Removed `ExecutionStrategy.Simple` enum value - ✅ Migration: Use `None` or `strategy=ExecutionStrategy.DataFusion` ## Behavior - All queries now use DataFusion planner (same functionality, better optimization) - No feature loss - DataFusion supports all Cypher features that Simple did - Performance likely improves due to DataFusion's query optimization ## Testing ✅ All 295 unit tests pass ✅ Package builds successfully ✅ No remaining references to Simple executor in codebase ## Impact Users passing `ExecutionStrategy::Simple` will need to update their code to use the default DataFusion strategy. This is acceptable as DataFusion provides strictly more features and better performance. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 82b98a2 commit 34fb4f5

11 files changed

Lines changed: 17 additions & 1204 deletions

File tree

crates/lance-graph-python/src/graph.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ use crate::RT;
4646
pub enum ExecutionStrategy {
4747
/// Use DataFusion query planner (default, full feature support)
4848
DataFusion,
49-
/// Use simple single-table executor (legacy, limited features)
50-
Simple,
5149
/// Use Lance native executor (not yet implemented)
5250
LanceNative,
5351
}
@@ -56,7 +54,6 @@ impl From<ExecutionStrategy> for RustExecutionStrategy {
5654
fn from(strategy: ExecutionStrategy) -> Self {
5755
match strategy {
5856
ExecutionStrategy::DataFusion => RustExecutionStrategy::DataFusion,
59-
ExecutionStrategy::Simple => RustExecutionStrategy::Simple,
6057
ExecutionStrategy::LanceNative => RustExecutionStrategy::LanceNative,
6158
}
6259
}
@@ -548,7 +545,7 @@ impl CypherQuery {
548545
///
549546
/// >>> # Explicit strategy
550547
/// >>> from lance.graph import ExecutionStrategy
551-
/// >>> result = query.execute(datasets, strategy=ExecutionStrategy.Simple)
548+
/// >>> result = query.execute(datasets, strategy=ExecutionStrategy.DataFusion)
552549
#[pyo3(signature = (datasets, strategy=None))]
553550
fn execute(
554551
&self,

crates/lance-graph/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A graph query engine for Lance datasets with Cypher syntax support. This crate e
77
- Cypher query parsing and AST construction
88
- Graph configuration for mapping Lance tables to nodes and relationships
99
- Semantic validation with typed `GraphError` diagnostics
10-
- Pluggable execution strategies (DataFusion planner by default, simple executor, Lance Native placeholder)
10+
- Pluggable execution strategies (DataFusion planner by default, Lance Native placeholder)
1111
- Async query execution that returns Arrow `RecordBatch` results
1212
- JSON-serializable parameter binding for reusable query templates
1313
- Logical plan debugging via `CypherQuery::explain`
@@ -50,10 +50,7 @@ let query = CypherQuery::new("MATCH (p:Person) WHERE p.age > $min RETURN p.name"
5050

5151
let runtime = tokio::runtime::Runtime::new()?;
5252
// Use default DataFusion-based execution
53-
let result = runtime.block_on(query.execute(tables.clone(), None))?;
54-
55-
// Opt in to the simple executor if you only need projection/filter support.
56-
let simple = runtime.block_on(query.execute(tables, Some(ExecutionStrategy::Simple)))?;
53+
let result = runtime.block_on(query.execute(tables, None))?;
5754
```
5855

5956
The query expects a `HashMap<String, RecordBatch>` keyed by the labels and relationship types referenced in the Cypher text. Each record batch should expose the columns configured through `GraphConfig` (ID fields, property fields, etc.). Relationship mappings also expect a batch keyed by the relationship type (for example `KNOWS`) that contains the configured source/target ID columns and any optional property columns.
@@ -92,10 +89,10 @@ let config = GraphConfig::builder()
9289
- `CypherQuery::new` parses Cypher text into the internal AST.
9390
- `with_config` attaches the graph configuration used for validation and execution.
9491
- `with_parameter` / `with_parameters` bind JSON-serializable values that can be referenced as `$param` in the Cypher text.
95-
- `execute` is asynchronous and returns an Arrow `RecordBatch`. Pass `None` for the default DataFusion planner or `Some(ExecutionStrategy::Simple)` for the single-table executor. `ExecutionStrategy::LanceNative` is reserved for future native execution support and currently errors.
92+
- `execute` is asynchronous and returns an Arrow `RecordBatch`. Pass `None` to use the default DataFusion planner. `ExecutionStrategy::LanceNative` is reserved for future native execution support and currently errors.
9693
- `explain` is asynchronous and returns a formatted string containing the graph logical plan alongside the DataFusion logical and physical plans.
9794

98-
Queries with a single `MATCH` clause containing a path pattern are planned as joins using the provided mappings. Other queries can opt into the single-table projection/filter pipeline via `ExecutionStrategy::Simple` when DataFusion's planner is unnecessary.
95+
All queries use the DataFusion planner for optimization and execution.
9996

10097
A builder (`CypherQueryBuilder`) is also available for constructing queries programmatically without parsing text.
10198

@@ -116,7 +113,6 @@ Basic aggregations like `COUNT` are supported. Optional matches and subqueries a
116113
- `semantic` – Lightweight semantic checks on the AST.
117114
- `logical_plan` – Builders for graph logical plans.
118115
- `datafusion_planner` – DataFusion-based execution planning.
119-
- `simple_executor` – Simple single-table executor.
120116
- `config` – Graph configuration types and builders.
121117
- `query` – High level `CypherQuery` API and runtime.
122118
- `error``GraphError` and result helpers.

crates/lance-graph/benches/graph_execution.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use arrow_schema::{DataType, Field, Schema as ArrowSchema};
2222
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
2323
use futures::TryStreamExt;
2424
use lance::dataset::{Dataset, WriteMode, WriteParams};
25-
use lance_graph::{CypherQuery, ExecutionStrategy, GraphConfig};
25+
use lance_graph::{CypherQuery, GraphConfig};
2626
use tempfile::TempDir;
2727

2828
fn create_people_batch() -> RecordBatch {
@@ -71,11 +71,7 @@ fn execute_cypher_query(
7171
q: &CypherQuery,
7272
datasets: HashMap<String, RecordBatch>,
7373
) -> RecordBatch {
74-
rt.block_on(async move {
75-
q.execute(datasets, Some(ExecutionStrategy::Simple))
76-
.await
77-
.unwrap()
78-
})
74+
rt.block_on(async move { q.execute(datasets, None).await.unwrap() })
7975
}
8076

8177
fn make_people_batch(n: usize) -> RecordBatch {

crates/lance-graph/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ pub mod parameter_substitution;
4747
pub mod parser;
4848
pub mod query;
4949
pub mod semantic;
50-
pub mod simple_executor;
5150
pub mod sql_catalog;
5251
pub mod sql_query;
5352
pub mod table_readers;

0 commit comments

Comments
 (0)