Struct Catalog

Source
pub struct Catalog { /* private fields */ }
Expand description

User-facing catalog API, accessible through SparkSession.catalog.

Implementations§

Source§

impl Catalog

Source

pub fn new(spark_session: SparkSession) -> Self

Source

pub async fn current_catalog(self) -> Result<String, SparkError>

Returns the current default catalog in this session

Source

pub async fn set_current_catalog( self, catalog_name: &str, ) -> Result<(), SparkError>

Sets the current default catalog in this session

Source

pub async fn list_catalogs( self, pattern: Option<&str>, ) -> Result<RecordBatch, SparkError>

Returns a list of catalogs in this session

Source

pub async fn current_database(self) -> Result<String, SparkError>

Returns the current default database in this session

Source

pub async fn set_current_database(self, db_name: &str) -> Result<(), SparkError>

Sets the current default database in this session

Source

pub async fn list_databases( self, pattern: Option<&str>, ) -> Result<RecordBatch, SparkError>

Returns a list of databases in this session

Source

pub async fn get_database( self, db_name: &str, ) -> Result<RecordBatch, SparkError>

Get the database with the specified name

Source

pub async fn database_exists(self, db_name: &str) -> Result<bool, SparkError>

Check if the database with the specified name exists.

Source

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

Source

pub async fn get_table( self, table_name: &str, ) -> Result<RecordBatch, SparkError>

Get the table or view with the specified name.

Source

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.

Source

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.

Source

pub async fn get_function( self, function_name: &str, ) -> Result<RecordBatch, SparkError>

Get the function with the specified name.

Source

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

Source

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.

Source

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.

Source

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.

Source

pub async fn is_cached(self, table_name: &str) -> Result<bool, SparkError>

Returns true if the table is currently cached in-memory.

Source

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.

Source

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.

Source

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.

Source

pub async fn uncache_table(self, table_name: &str) -> Result<(), SparkError>

Removes the specified table from the in-memory cache.

Source

pub async fn clear_cache(self) -> Result<(), SparkError>

Removes all cached tables from the in-memory cache.

Source

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.

Source

pub async fn recover_partitions( self, table_name: &str, ) -> Result<(), SparkError>

Recovers all the partitions of the given table and updates the catalog.

Source

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§

Source§

impl Clone for Catalog

Source§

fn clone(&self) -> Catalog

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Catalog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T