askalt commented on PR #2123:
URL: https://github.com/apache/iceberg-rust/pull/2123#issuecomment-3877363686
> Hi @askalt, thanks for raising this PR!
>
> > when using a custom catalog implementation
>
> I'm assuming you are using a custom `Catalog/SchemaProvider` with
`IcebergTableProvider`?
>
> I'm trying to understand your use case better. Some examples on how a
custom `Catalog/SchemaProvider` with `IcebergTableProvider` would benefit you
would be very helpful!
>
> Also I was wondering if making `IcebergTableProvider::try_new` a `pub`
function would be an easier solution for you?
Hi! We actually use `MemorySchemaProvider` from DF and support iceberg
tables creation with some known arrow schema (it is why
`IcebergTableProviderBuilder::with_schema` is present). The code looks roughly
like:
```rust
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(())
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]