pub struct Catalog { /* private fields */ }Expand description
User-facing catalog API, accessible through SparkSession.catalog.
Implementations§
Source§impl Catalog
impl Catalog
pub fn new(spark_session: SparkSession) -> Self
Sourcepub async fn current_catalog(self) -> Result<String, SparkError>
pub async fn current_catalog(self) -> Result<String, SparkError>
Returns the current default catalog in this session
Sourcepub async fn set_current_catalog(
self,
catalog_name: &str,
) -> Result<(), SparkError>
pub async fn set_current_catalog( self, catalog_name: &str, ) -> Result<(), SparkError>
Sets the current default catalog in this session
Sourcepub async fn list_catalogs(
self,
pattern: Option<&str>,
) -> Result<RecordBatch, SparkError>
pub async fn list_catalogs( self, pattern: Option<&str>, ) -> Result<RecordBatch, SparkError>
Returns a list of catalogs in this session
Sourcepub async fn current_database(self) -> Result<String, SparkError>
pub async fn current_database(self) -> Result<String, SparkError>
Returns the current default database in this session
Sourcepub async fn set_current_database(self, db_name: &str) -> Result<(), SparkError>
pub async fn set_current_database(self, db_name: &str) -> Result<(), SparkError>
Sets the current default database in this session
Sourcepub async fn list_databases(
self,
pattern: Option<&str>,
) -> Result<RecordBatch, SparkError>
pub async fn list_databases( self, pattern: Option<&str>, ) -> Result<RecordBatch, SparkError>
Returns a list of databases in this session
Sourcepub async fn get_database(
self,
db_name: &str,
) -> Result<RecordBatch, SparkError>
pub async fn get_database( self, db_name: &str, ) -> Result<RecordBatch, SparkError>
Get the database with the specified name
Sourcepub async fn database_exists(self, db_name: &str) -> Result<bool, SparkError>
pub async fn database_exists(self, db_name: &str) -> Result<bool, SparkError>
Check if the database with the specified name exists.
Sourcepub async fn list_tables(
self,
pattern: Option<&str>,
db_name: Option<&str>,
) -> Result<RecordBatch, SparkError>
pub async fn list_tables( self, pattern: Option<&str>, db_name: Option<&str>, ) -> Result<RecordBatch, SparkError>
Returns a list of tables/views in the specific database
Sourcepub async fn get_table(
self,
table_name: &str,
) -> Result<RecordBatch, SparkError>
pub async fn get_table( self, table_name: &str, ) -> Result<RecordBatch, SparkError>
Get the table or view with the specified name.
Sourcepub async fn list_functions(
self,
db_name: Option<&str>,
pattern: Option<&str>,
) -> Result<RecordBatch, SparkError>
pub async fn list_functions( self, db_name: Option<&str>, pattern: Option<&str>, ) -> Result<RecordBatch, SparkError>
Returns a list of functions registered in the specified database.
Sourcepub async fn function_exists(
self,
function_name: &str,
db_name: Option<&str>,
) -> Result<bool, SparkError>
pub async fn function_exists( self, function_name: &str, db_name: Option<&str>, ) -> Result<bool, SparkError>
Check if the function with the specified name exists.
Sourcepub async fn get_function(
self,
function_name: &str,
) -> Result<RecordBatch, SparkError>
pub async fn get_function( self, function_name: &str, ) -> Result<RecordBatch, SparkError>
Get the function with the specified name.
Sourcepub async fn list_columns(
self,
table_name: &str,
db_name: Option<&str>,
) -> Result<RecordBatch, SparkError>
pub async fn list_columns( self, table_name: &str, db_name: Option<&str>, ) -> Result<RecordBatch, SparkError>
Returns a list of columns for the given tables/views in the specific database
Sourcepub async fn table_exists(
self,
table_name: &str,
db_name: Option<&str>,
) -> Result<bool, SparkError>
pub async fn table_exists( self, table_name: &str, db_name: Option<&str>, ) -> Result<bool, SparkError>
Check if the table or view with the specified name exists.
Sourcepub async fn drop_temp_view(self, view_name: &str) -> Result<bool, SparkError>
pub async fn drop_temp_view(self, view_name: &str) -> Result<bool, SparkError>
Drops the local temporary view with the given view name in the catalog.
Sourcepub async fn drop_global_temp_view(
self,
view_name: &str,
) -> Result<bool, SparkError>
pub async fn drop_global_temp_view( self, view_name: &str, ) -> Result<bool, SparkError>
Drops the global temporary view with the given view name in the catalog.
Sourcepub async fn is_cached(self, table_name: &str) -> Result<bool, SparkError>
pub async fn is_cached(self, table_name: &str) -> Result<bool, SparkError>
Returns true if the table is currently cached in-memory.
Sourcepub async fn create_table(
&self,
table_name: &str,
path: Option<&str>,
source: Option<&str>,
description: Option<&str>,
schema: Option<StructType>,
options: Option<HashMap<String, String>>,
) -> Result<DataFrame, SparkError>
pub async fn create_table( &self, table_name: &str, path: Option<&str>, source: Option<&str>, description: Option<&str>, schema: Option<StructType>, options: Option<HashMap<String, String>>, ) -> Result<DataFrame, SparkError>
Creates a table based on the dataset in a data source.
Sourcepub async fn create_external_table(
&self,
table_name: &str,
path: Option<&str>,
source: Option<&str>,
schema: Option<StructType>,
options: Option<HashMap<String, String>>,
) -> Result<DataFrame, SparkError>
pub async fn create_external_table( &self, table_name: &str, path: Option<&str>, source: Option<&str>, schema: Option<StructType>, options: Option<HashMap<String, String>>, ) -> Result<DataFrame, SparkError>
Creates a table based on the dataset in a data source.
Sourcepub async fn cache_table(
self,
table_name: &str,
storage_level: Option<StorageLevel>,
) -> Result<(), SparkError>
pub async fn cache_table( self, table_name: &str, storage_level: Option<StorageLevel>, ) -> Result<(), SparkError>
Caches the specified table in-memory or with given storage level.
Sourcepub async fn uncache_table(self, table_name: &str) -> Result<(), SparkError>
pub async fn uncache_table(self, table_name: &str) -> Result<(), SparkError>
Removes the specified table from the in-memory cache.
Sourcepub async fn clear_cache(self) -> Result<(), SparkError>
pub async fn clear_cache(self) -> Result<(), SparkError>
Removes all cached tables from the in-memory cache.
Sourcepub async fn refresh_table(self, table_name: &str) -> Result<(), SparkError>
pub async fn refresh_table(self, table_name: &str) -> Result<(), SparkError>
Invalidates and refreshes all the cached data (and the associated metadata) for any DataFrame that contains the given data source path.
Sourcepub async fn recover_partitions(
self,
table_name: &str,
) -> Result<(), SparkError>
pub async fn recover_partitions( self, table_name: &str, ) -> Result<(), SparkError>
Recovers all the partitions of the given table and updates the catalog.
Sourcepub async fn refresh_by_path(self, path: &str) -> Result<(), SparkError>
pub async fn refresh_by_path(self, path: &str) -> Result<(), SparkError>
Invalidates and refreshes all the cached data (and the associated metadata) for any DataFrame that contains the given data source path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Catalog
impl !RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl !UnwindSafe for Catalog
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request