feat(datafusion): expor table provider constructor#2123
feat(datafusion): expor table provider constructor#2123askalt wants to merge 1 commit intoapache:mainfrom
Conversation
deeb6b8 to
9d7be3b
Compare
|
Hi @askalt, thanks for raising this PR!
I'm assuming you are using a custom I'm trying to understand your use case better. Some examples on how a custom Also I was wondering if making |
Hi! We actually use async fn create_table(
&self,
ctx: &SessionContext,
name: String,
schema: SchemaRef,
) -> Result<()> {
let inner_schema = arrow_schema_to_schema(&schema)?;
let table_creation = TableCreation::builder()
.name(name.clone())
.schema(inner_schema)
.build();
let table = self
.catalog
.create_table(&self.nmid, table_creation)
.await?;
let table_provider = IcebergTableProviderBuilder::new(
Arc::clone(&self.catalog) as _,
table.identifier().clone(),
)
.with_schema(Some(schema))
.build()
.await?;
session_state.register_table(name, Arc::new(table_provider));
Ok(())
} |
|
Thanks for the example! But I'm still a bit confused about why you need to pass Imo, the schema should come from iceberg table metadata otherwise there may be unexpected behaviors. |
9d7be3b to
85d6ce3
Compare
85d6ce3 to
497ff3b
Compare
Yes, it seems we could avoid explicit schema passing. Reworked to just export the constructor. |
At the moment, the provider is only available through the Iceberg implementation of the DF catalog, which can be inconvenient when using a custom catalog implementation. This patch adds a public builder, allowing external users to create the provider.