Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions datafusion/session/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
56 changes: 41 additions & 15 deletions datafusion/session/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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::{
Expand Down Expand Up @@ -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.
Expand All @@ -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()
)))
}
}

Expand Down
Loading