Skip to content

Commit 72b8a86

Browse files
committed
refactor(planner): remove DataFusion from query planning path
Remove DataFusion SessionContext, UDF registration, catalog provider, and all DataFusion-dependent helpers from QueryContext. Planning now goes exclusively through nodedb-sql. Deleted (~1700 lines): - catalog.rs (DataFusion SchemaProvider) - expr_convert.rs, sql_expr_convert.rs (DataFusion Expr converters) - hints.rs (query hint extraction) - stream_table/ (DataFusion table provider for change streams) Simplified: - context.rs: removed session field, UDF registration, inliner - prepared/parser.rs: replaced DataFusion type inference with sqlparser + nodedb-sql catalog lookup - routing.rs: removed dead temp table register/deregister - eval.rs: uses standalone DataFusion session (not QueryContext) DataFusion remains only for: - Procedural executor scalar expression evaluation (eval.rs) - Function body validation at CREATE FUNCTION (validate.rs) - UDF trait implementations (needed by above two)
1 parent e259e65 commit 72b8a86

11 files changed

Lines changed: 161 additions & 1687 deletions

File tree

nodedb/src/control/planner/catalog.rs

Lines changed: 0 additions & 487 deletions
This file was deleted.

nodedb/src/control/planner/context.rs

Lines changed: 28 additions & 273 deletions
Large diffs are not rendered by default.

nodedb/src/control/planner/expr_convert.rs

Lines changed: 0 additions & 88 deletions
This file was deleted.

nodedb/src/control/planner/hints.rs

Lines changed: 0 additions & 138 deletions
This file was deleted.

nodedb/src/control/planner/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
pub(crate) mod auto_tier;
2-
pub mod catalog;
32
pub mod catalog_adapter;
43
pub mod context;
5-
pub mod expr_convert;
6-
pub mod hints;
74
pub mod physical;
85
pub mod procedural;
96
pub mod rls_injection;
10-
pub mod sql_expr_convert;
117
pub mod sql_plan_convert;
12-
pub mod stream_table;
138
pub mod udf;
149
pub mod wasm;

nodedb/src/control/planner/procedural/executor/eval.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,16 @@ pub async fn evaluate_to_value(
128128
/// Execute a SQL expression via DataFusion and return the result batches.
129129
///
130130
/// Wraps the expression in `SELECT (<expr>) as __result` and collects.
131+
/// Uses a standalone DataFusion session (not QueryContext) for scalar evaluation.
131132
pub async fn eval_sql_expr(
132-
state: &SharedState,
133-
tenant_id: TenantId,
133+
_state: &SharedState,
134+
_tenant_id: TenantId,
134135
expr: &str,
135136
context: &str,
136137
) -> crate::Result<Vec<datafusion::arrow::record_batch::RecordBatch>> {
137-
let ctx = crate::control::planner::context::QueryContext::for_state(state, tenant_id.as_u32());
138+
let session = datafusion::execution::context::SessionContext::new();
138139
let select_sql = format!("SELECT ({expr}) as __result");
139-
let df = ctx
140-
.session()
140+
let df = session
141141
.sql(&select_sql)
142142
.await
143143
.map_err(|e| crate::Error::PlanError {

0 commit comments

Comments
 (0)