From 165c56ecf1b19df7c0e2d2f5387ef3a1047ccbef Mon Sep 17 00:00:00 2001 From: Brent Gardner Date: Sat, 22 Oct 2022 14:39:02 -0600 Subject: [PATCH] delta & ballista tests pass --- datafusion/core/src/datasource/datasource.rs | 9 +++++++-- datafusion/core/src/test_util.rs | 2 ++ datafusion/proto/src/lib.rs | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/datafusion/core/src/datasource/datasource.rs b/datafusion/core/src/datasource/datasource.rs index 8f9ebf482f242..78d62d6616305 100644 --- a/datafusion/core/src/datasource/datasource.rs +++ b/datafusion/core/src/datasource/datasource.rs @@ -28,6 +28,7 @@ use crate::error::Result; use crate::execution::context::SessionState; use crate::logical_expr::Expr; use crate::physical_plan::ExecutionPlan; +use crate::prelude::SessionContext; /// Source table #[async_trait] @@ -83,6 +84,10 @@ pub trait TableProviderFactory: Sync + Send { async fn create(&self, url: &str) -> Result>; /// Create a TableProvider during execution with schema already known from planning - fn with_schema(&self, schema: SchemaRef, url: &str) - -> Result>; + fn with_schema( + &self, + ctx: &SessionContext, + schema: SchemaRef, + url: &str, + ) -> Result>; } diff --git a/datafusion/core/src/test_util.rs b/datafusion/core/src/test_util.rs index b1410c8735488..66c2b04add7b5 100644 --- a/datafusion/core/src/test_util.rs +++ b/datafusion/core/src/test_util.rs @@ -26,6 +26,7 @@ use crate::datasource::{empty::EmptyTable, provider_as_source, TableProvider}; use crate::execution::context::SessionState; use crate::logical_expr::{LogicalPlanBuilder, UNNAMED_TABLE}; use crate::physical_plan::ExecutionPlan; +use crate::prelude::SessionContext; use arrow::datatypes::{DataType, Field, Schema, SchemaRef}; use async_trait::async_trait; use datafusion_common::DataFusionError; @@ -339,6 +340,7 @@ impl TableProviderFactory for TestTableFactory { fn with_schema( &self, + _ctx: &SessionContext, _schema: SchemaRef, url: &str, ) -> datafusion_common::Result> { diff --git a/datafusion/proto/src/lib.rs b/datafusion/proto/src/lib.rs index e4806cdd79f8b..7767c67d316cd 100644 --- a/datafusion/proto/src/lib.rs +++ b/datafusion/proto/src/lib.rs @@ -183,7 +183,7 @@ mod roundtrip_tests { .table_factories .get("testtable") .expect("Unable to find testtable factory"); - let provider = (*factory).with_schema(schema, msg.url.as_str())?; + let provider = (*factory).with_schema(ctx, schema, msg.url.as_str())?; Ok(provider) }