pub struct SQLContext { /* private fields */ }Expand description
Implementations§
Source§impl SQLContext
impl SQLContext
Sourcepub async fn register_catalog(
&mut self,
catalog_name: impl Into<String>,
catalog: Arc<dyn Catalog>,
) -> DFResult<()>
pub async fn register_catalog( &mut self, catalog_name: impl Into<String>, catalog: Arc<dyn Catalog>, ) -> DFResult<()>
Registers a Paimon catalog under the given name.
The first registered catalog automatically becomes the current catalog for both Paimon-handled SQL and DataFusion-delegated SQL (SELECT, etc.). A “default” database is created if it does not already exist (matching the behavior of Spark/Flink Paimon catalogs).
Sourcepub async fn set_current_catalog(
&mut self,
catalog_name: impl Into<String>,
) -> DFResult<()>
pub async fn set_current_catalog( &mut self, catalog_name: impl Into<String>, ) -> DFResult<()>
Sets the current catalog for unqualified table references.
Sourcepub async fn set_current_database(&self, database_name: &str) -> DFResult<()>
pub async fn set_current_database(&self, database_name: &str) -> DFResult<()>
Sets the current database for unqualified table references.
Sourcepub fn ctx(&self) -> &SessionContext
pub fn ctx(&self) -> &SessionContext
Returns a reference to the inner SessionContext.
Sourcepub fn register_temp_table(
&self,
name: impl Into<TableReference>,
table: Arc<dyn TableProvider>,
) -> DFResult<()>
pub fn register_temp_table( &self, name: impl Into<TableReference>, table: Arc<dyn TableProvider>, ) -> DFResult<()>
Registers a temporary in-memory table or view.
The name parameter accepts flexible table references, similar to DataFusion:
"my_table"— uses the current catalog and current database"database.my_table"— uses the current catalog with the specified database"catalog.database.my_table"— fully qualified
The table exists only for the lifetime of this SQLContext instance.
Sourcepub fn deregister_temp_table(
&self,
name: impl Into<TableReference>,
) -> DFResult<Option<Arc<dyn TableProvider>>>
pub fn deregister_temp_table( &self, name: impl Into<TableReference>, ) -> DFResult<Option<Arc<dyn TableProvider>>>
Deregisters a temporary table or view.
Accepts the same flexible name format as register_temp_table.
Sourcepub fn temp_table_exist(
&self,
name: impl Into<TableReference>,
) -> DFResult<bool>
pub fn temp_table_exist( &self, name: impl Into<TableReference>, ) -> DFResult<bool>
Returns whether a temporary table or view with the given name already exists.
Accepts the same flexible name format as register_temp_table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SQLContext
impl !RefUnwindSafe for SQLContext
impl Send for SQLContext
impl Sync for SQLContext
impl Unpin for SQLContext
impl UnsafeUnpin for SQLContext
impl !UnwindSafe for SQLContext
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
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>
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>
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