File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
crates/integrations/datafusion/src Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,4 @@ pub use error::*;
2424mod physical_plan;
2525mod schema;
2626mod table;
27+ pub use table:: * ;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ use crate::physical_plan::scan::IcebergTableScan;
3333
3434/// Represents a [`TableProvider`] for the Iceberg [`Catalog`],
3535/// managing access to a [`Table`].
36- pub ( crate ) struct IcebergTableProvider {
36+ pub struct IcebergTableProvider {
3737 /// A table in the catalog.
3838 table : Table ,
3939 /// A reference-counted arrow `Schema`.
@@ -56,6 +56,13 @@ impl IcebergTableProvider {
5656
5757 Ok ( IcebergTableProvider { table, schema } )
5858 }
59+
60+ /// Asynchronously tries to construct a new [`IcebergTableProvider`]
61+ /// using the given table. Can be used to create a table provider from an existing table regardless of the catalog implementation.
62+ pub async fn try_new_from_table ( table : Table ) -> Result < Self > {
63+ let schema = Arc :: new ( schema_to_arrow_schema ( table. metadata ( ) . current_schema ( ) ) ?) ;
64+ Ok ( IcebergTableProvider { table, schema } )
65+ }
5966}
6067
6168#[ async_trait]
You can’t perform that action at this time.
0 commit comments