Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
SessionConfig in datafusion::execution::context - Rust
[go: Go Back, main page]

pub struct SessionConfig {
    pub target_partitions: usize,
    pub repartition_joins: bool,
    pub repartition_aggregations: bool,
    pub repartition_windows: bool,
    pub parquet_pruning: bool,
    pub config_options: ConfigOptions,
    /* private fields */
}
Expand description

Configuration options for session context

Fields

target_partitions: usize

Number of partitions for query execution. Increasing partitions can increase concurrency.

repartition_joins: bool

Should DataFusion repartition data using the join keys to execute joins in parallel using the provided target_partitions level

repartition_aggregations: bool

Should DataFusion repartition data using the aggregate keys to execute aggregates in parallel using the provided target_partitions level

repartition_windows: bool

Should DataFusion repartition data using the partition keys to execute window functions in parallel using the provided target_partitions level

parquet_pruning: bool

Should DataFusion parquet reader using the predicate to prune data

config_options: ConfigOptions

Configuration options

Implementations

Create an execution config with default setting

Create an execution config with config options read from the environment

Set a configuration option

Set a boolean configuration option

Set a generic u64 configuration option

Customize batch size

Customize target_partitions

Selects a name for the default catalog and schema

Controls whether the default catalog and schema will be automatically created

Enables or disables the inclusion of information_schema virtual tables

Enables or disables the use of repartitioning for joins to improve parallelism

Enables or disables the use of repartitioning for aggregations to improve parallelism

Enables or disables the use of repartitioning for window functions to improve parallelism

Enables or disables the use of pruning predicate for parquet readers to skip row groups

Get the currently configured batch size

Get the current configuration options

Convert configuration options to name-value pairs with values converted to strings. Note that this method will eventually be deprecated and replaced by [config_options].

Add extensions.

Extensions can be used to attach extra data to the session config – e.g. tracing information or caches. Extensions are opaque and the types are unknown to DataFusion itself, which makes them extremely flexible. 1

Extensions are stored within an Arc so they do NOT require Clone. The are immutable. If you need to modify their state over their lifetime – e.g. for caches – you need to establish some for of interior mutability.

Extensions are indexed by their type T. If multiple values of the same type are provided, only the last one will be kept.

You may use get_extension to retrieve extensions.

Example
use std::sync::Arc;
use datafusion::execution::context::SessionConfig;

// application-specific extension types
struct Ext1(u8);
struct Ext2(u8);
struct Ext3(u8);

let ext1a = Arc::new(Ext1(10));
let ext1b = Arc::new(Ext1(11));
let ext2 = Arc::new(Ext2(2));

let cfg = SessionConfig::default()
    // will only remember the last Ext1
    .with_extension(Arc::clone(&ext1a))
    .with_extension(Arc::clone(&ext1b))
    .with_extension(Arc::clone(&ext2));

let ext1_received = cfg.get_extension::<Ext1>().unwrap();
assert!(!Arc::ptr_eq(&ext1_received, &ext1a));
assert!(Arc::ptr_eq(&ext1_received, &ext1b));

let ext2_received = cfg.get_extension::<Ext2>().unwrap();
assert!(Arc::ptr_eq(&ext2_received, &ext2));

assert!(cfg.get_extension::<Ext3>().is_none());

  1. Compare that to ConfigOptions which only supports ScalarValue payloads. 

Get extension, if any for the specified type T exists.

See with_extension on how to add attach extensions.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.