Skip to content

Commit

Permalink
federated read provider in write table provider (#44)
Browse files Browse the repository at this point in the history
* federated writer in reader

* simplify
  • Loading branch information
y-f-u authored Aug 16, 2024
1 parent 54dde97 commit a726db9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/duckdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ impl TableProviderFactory for DuckDBTableProviderFactory {
None,
));

let read_provider = Arc::new(read_provider.create_federated_table_provider()?);
Ok(DuckDBTableWriter::create(
read_provider,
duckdb,
Expand Down
2 changes: 1 addition & 1 deletion src/duckdb/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use super::to_datafusion_error;

#[derive(Clone)]
pub struct DuckDBTableWriter {
read_provider: Arc<dyn TableProvider>,
pub read_provider: Arc<dyn TableProvider>,
duckdb: Arc<DuckDB>,
on_conflict: Option<OnConflict>,
}
Expand Down
1 change: 1 addition & 0 deletions src/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ impl TableProviderFactory for PostgresTableProviderFactory {
Some(Engine::Postgres),
));

let read_provider = Arc::new(read_provider.create_federated_table_provider()?);
Ok(PostgresTableWriter::create(
read_provider,
postgres,
Expand Down
1 change: 1 addition & 0 deletions src/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ impl TableProviderFactory for SqliteTableProviderFactory {
.context(DanglingReferenceToSqliteSnafu)
.map_err(to_datafusion_error)?;

let read_provider = Arc::new(read_provider.create_federated_table_provider()?);
Ok(SqliteTableWriter::create(
read_provider,
sqlite,
Expand Down

0 comments on commit a726db9

Please sign in to comment.