Skip to content

Commit

Permalink
delta & ballista tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Gardner committed Oct 22, 2022
1 parent 70f7693 commit 165c56e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions datafusion/core/src/datasource/datasource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -83,6 +84,10 @@ pub trait TableProviderFactory: Sync + Send {
async fn create(&self, url: &str) -> Result<Arc<dyn TableProvider>>;

/// Create a TableProvider during execution with schema already known from planning
fn with_schema(&self, schema: SchemaRef, url: &str)
-> Result<Arc<dyn TableProvider>>;
fn with_schema(
&self,
ctx: &SessionContext,
schema: SchemaRef,
url: &str,
) -> Result<Arc<dyn TableProvider>>;
}
2 changes: 2 additions & 0 deletions datafusion/core/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -339,6 +340,7 @@ impl TableProviderFactory for TestTableFactory {

fn with_schema(
&self,
_ctx: &SessionContext,
_schema: SchemaRef,
url: &str,
) -> datafusion_common::Result<Arc<dyn TableProvider>> {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 165c56e

Please sign in to comment.