Apache DataFusion SQL Query Engine
perf(session): cut `datafusion-session` compile time ~1.7x (#24326)
Daniël Heres8c099dc15058
diff --git a/Cargo.lock b/Cargo.lockindex b5d5674565..4cb6117da3 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2609,6 +2609,7 @@ dependencies = ["datafusion-execution","datafusion-expr","datafusion-physical-plan",+ "futures","parking_lot",]diff --git a/datafusion/session/Cargo.toml b/datafusion/session/Cargo.tomlindex 2bbbdd20df..e6c277a8b8 100644--- a/datafusion/session/Cargo.toml+++ b/datafusion/session/Cargo.toml@@ -37,6 +37,7 @@ datafusion-common = { workspace = true }datafusion-execution = { workspace = true }datafusion-expr = { workspace = true }datafusion-physical-plan = { workspace = true }+futures = { workspace = true }parking_lot = { workspace = true }# Note: add additional linter rules in lib.rs.diff --git a/datafusion/session/src/table.rs b/datafusion/session/src/table.rsindex 69e7e731b3..9dbda40b9b 100644--- a/datafusion/session/src/table.rs+++ b/datafusion/session/src/table.rs@@ -18,6 +18,7 @@use std::any::Any;use std::borrow::Cow;use std::fmt::Debug;+use std::future::ready;use std::sync::Arc;use crate::session::Session;@@ -27,6 +28,7 @@ use datafusion_common::{Constraints, Statistics, not_impl_err};use datafusion_common::{DFSchemaRef, Result, internal_err};use datafusion_expr::Expr;use datafusion_expr::statistics::StatisticsRequest;+use futures::future::BoxFuture;use datafusion_expr::dml::{InsertOp, MergeIntoClause};use datafusion_expr::{@@ -351,25 +353,41 @@ pub trait TableProvider: Any + Debug + Sync + Send {////// Returns an [`ExecutionPlan`] producing a single row with `count` (UInt64)./// Empty `filters` deletes all rows.- async fn delete_from(- &self,- _state: &dyn Session,+ fn delete_from<'life0, 'life1, 'async_trait>(+ &'life0 self,+ _state: &'life1 dyn Session,_filters: Vec<Expr>,- ) -> Result<Arc<dyn ExecutionPlan>> {- not_impl_err!("DELETE not supported for {} table", self.table_type())+ ) -> BoxFuture<'async_trait, Result<Arc<dyn ExecutionPlan>>>+ where+ 'life0: 'async_trait,+ 'life1: 'async_trait,+ Self: 'async_trait,+ {+ Box::pin(ready(not_impl_err!(+ "DELETE not supported for {} table",+ self.table_type()+ )))}/// Update rows matching the filter predicates.////// Returns an [`ExecutionPlan`] producing a single row with `count` (UInt64)./// Empty `filters` updates all rows.- async fn update(- &self,- _state: &dyn Session,+ fn update<'life0, 'life1, 'async_trait>(+ &'life0 self,+ _state: &'life1 dyn Session,_assignments: Vec<(String, Expr)>,_filters: Vec<Expr>,- ) -> Result<Arc<dyn ExecutionPlan>> {- not_impl_err!("UPDATE not supported for {} table", self.table_type())+ ) -> BoxFuture<'async_trait, Result<Arc<dyn ExecutionPlan>>>+ where+ 'life0: 'async_trait,+ 'life1: 'async_trait,+ Self: 'async_trait,+ {+ Box::pin(ready(not_impl_err!(+ "UPDATE not supported for {} table",+ self.table_type()+ )))}/// Remove all rows from the table.@@ -391,15 +409,23 @@ pub trait TableProvider: Any + Debug + Sync + Send {/// The `clauses` describe the WHEN MATCHED / WHEN NOT MATCHED actions.////// Returns an [`ExecutionPlan`] producing a single row with `count` (UInt64).- async fn merge_into(- &self,- _state: &dyn Session,+ fn merge_into<'life0, 'life1, 'async_trait>(+ &'life0 self,+ _state: &'life1 dyn Session,_source: Arc<dyn ExecutionPlan>,_merge_schema: DFSchemaRef,_on: Expr,_clauses: Vec<MergeIntoClause>,- ) -> Result<Arc<dyn ExecutionPlan>> {- not_impl_err!("MERGE INTO not supported for {} table", self.table_type())+ ) -> BoxFuture<'async_trait, Result<Arc<dyn ExecutionPlan>>>+ where+ 'life0: 'async_trait,+ 'life1: 'async_trait,+ Self: 'async_trait,+ {+ Box::pin(ready(not_impl_err!(+ "MERGE INTO not supported for {} table",+ self.table_type()+ )))}}