Struct datafusion::common::config::TableOptions

source ·
pub struct TableOptions {
    pub csv: CsvOptions,
    pub parquet: TableParquetOptions,
    pub json: JsonOptions,
    pub current_format: Option<FileType>,
    pub extensions: Extensions,
}
Expand description

Represents the configuration options available for handling different table formats within a data processing application. This struct encompasses options for various file formats including CSV, Parquet, and JSON, allowing for flexible configuration of parsing and writing behaviors specific to each format. Additionally, it supports extending functionality through custom extensions.

Fields§

§csv: CsvOptions

Configuration options for CSV file handling. This includes settings like the delimiter, quote character, and whether the first row is considered as headers.

§parquet: TableParquetOptions

Configuration options for Parquet file handling. This includes settings for compression, encoding, and other Parquet-specific file characteristics.

§json: JsonOptions

Configuration options for JSON file handling.

§current_format: Option<FileType>

The current file format that the table operations should assume. This option allows for dynamic switching between the supported file types (e.g., CSV, Parquet, JSON).

§extensions: Extensions

Optional extensions that can be used to extend or customize the behavior of the table options. Extensions can be registered using Extensions::insert and might include custom file handling logic, additional configuration parameters, or other enhancements.

Implementations§

source§

impl TableOptions

source

pub fn new() -> TableOptions

Constructs a new instance of TableOptions with default settings.

§Returns

A new TableOptions instance with default configuration values.

source

pub fn set_file_format(&mut self, format: FileType)

Sets the file format for the table.

§Parameters
  • format: The file format to use (e.g., CSV, Parquet).
source

pub fn default_from_session_config(config: &ConfigOptions) -> TableOptions

Creates a new TableOptions instance initialized with settings from a given session config.

§Parameters
  • config: A reference to the session ConfigOptions from which to derive initial settings.
§Returns

A new TableOptions instance with settings applied from the session config.

source

pub fn combine_with_session_config( &self, config: &ConfigOptions ) -> TableOptions

Updates the current TableOptions with settings from a given session config.

§Parameters
  • config: A reference to the session ConfigOptions whose settings are to be applied.
§Returns

A new TableOptions instance with updated settings from the session config.

source

pub fn with_extensions(self, extensions: Extensions) -> TableOptions

Sets the extensions for this TableOptions instance.

§Parameters
  • extensions: The Extensions instance to set.
§Returns

A new TableOptions instance with the specified extensions applied.

source

pub fn set(&mut self, key: &str, value: &str) -> Result<(), DataFusionError>

Sets a specific configuration option.

§Parameters
  • key: The configuration key (e.g., “format.delimiter”).
  • value: The value to set for the specified key.
§Returns

A result indicating success or failure in setting the configuration option.

source

pub fn from_string_hash_map( settings: &HashMap<String, String> ) -> Result<TableOptions, DataFusionError>

Initializes a new TableOptions from a hash map of string settings.

§Parameters
  • settings: A hash map where each key-value pair represents a configuration setting.
§Returns

A result containing the new TableOptions instance or an error if any setting could not be applied.

source

pub fn alter_with_string_hash_map( &mut self, settings: &HashMap<String, String> ) -> Result<(), DataFusionError>

Modifies the current TableOptions instance with settings from a hash map.

§Parameters
  • settings: A hash map where each key-value pair represents a configuration setting.
§Returns

A result indicating success or failure in applying the settings.

source

pub fn entries(&self) -> Vec<ConfigEntry>

Retrieves all configuration entries from this TableOptions.

§Returns

A vector of ConfigEntry instances, representing all the configuration options within this TableOptions.

Trait Implementations§

source§

impl Clone for TableOptions

source§

fn clone(&self) -> TableOptions

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 ConfigField for TableOptions

source§

fn visit<V>(&self, v: &mut V, _key_prefix: &str, _description: &'static str)
where V: Visit,

Visits configuration settings for the current file format, or all formats if none is selected.

This method adapts the behavior based on whether a file format is currently selected in current_format. If a format is selected, it visits only the settings relevant to that format. Otherwise, it visits all available format settings.

source§

fn set(&mut self, key: &str, value: &str) -> Result<(), DataFusionError>

Sets a configuration value for a specific key within TableOptions.

This method delegates setting configuration values to the specific file format configurations, based on the current format selected. If no format is selected, it returns an error.

§Parameters
  • key: The configuration key specifying which setting to adjust, prefixed with the format (e.g., “format.delimiter”) for CSV format.
  • value: The value to set for the specified configuration key.
§Returns

A result indicating success or an error if the key is not recognized, if a format is not specified, or if setting the configuration value fails for the specific format.

source§

impl Debug for TableOptions

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for TableOptions

source§

fn default() -> TableOptions

Returns the “default value” for a type. 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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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