pub struct HudiTableFactory {}
Expand description
HudiTableFactory
is responsible for creating and configuring Hudi tables.
This factory handles the initialization of Hudi tables by creating configuration options from both session state and table creation commands.
§Examples
Creating a new HudiTableFactory
instance:
use datafusion::prelude::SessionContext;
use hudi_datafusion::HudiTableFactory;
// Initialize a new HudiTableFactory
let factory = HudiTableFactory::new();
// The factory can be used to create Hudi tables
let table = factory.create_table(...)?;
// Using `CREATE EXTERNAL TABLE` to register Hudi table:
let test_table = factory.create_table(...)?; // Table with path + url
let ctx = SessionContext::new();
// Register table in session using `CREATE EXTERNAL TABLE` command
let create_table_sql = format!(
"CREATE EXTERNAL TABLE {} STORED AS HUDI LOCATION '{}' {}",
test_table.as_ref(),
test_table.path(),
concat_as_sql_options(options)
);
ctx.sql(create_table_sql.as_str()).await?; // Query against this table
Implementations§
Trait Implementations§
Source§impl Debug for HudiTableFactory
impl Debug for HudiTableFactory
Source§impl Default for HudiTableFactory
impl Default for HudiTableFactory
Source§impl TableProviderFactory for HudiTableFactory
impl TableProviderFactory for HudiTableFactory
Source§fn create<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 dyn Session,
cmd: &'life2 CreateExternalTable,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn TableProvider>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 dyn Session,
cmd: &'life2 CreateExternalTable,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn TableProvider>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a TableProvider with the given url
Auto Trait Implementations§
impl Freeze for HudiTableFactory
impl RefUnwindSafe for HudiTableFactory
impl Send for HudiTableFactory
impl Sync for HudiTableFactory
impl Unpin for HudiTableFactory
impl UnwindSafe for HudiTableFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more