Skip to main content

ArrowMetalConfig

Struct ArrowMetalConfig 

Source
#[non_exhaustive]
pub struct ArrowMetalConfig { pub min_rows: usize, pub accept_inexact: bool, pub take_when_unknown: bool, pub sort: bool, pub topk: bool, pub aggregate: bool, pub filter: bool, pub aggregate_choice: AggregateChoice, pub table_rows: Option<usize>, pub join: bool, pub join_choice: JoinChoice, pub report_plans: usize, }
Expand description

When the rule takes a node.

Default is the measured take-list; ArrowMetalConfig::all takes every shape the rule can translate (what the differential grid and the benchmark use).

The fields are public to read and to set on a value (let mut c = ArrowMetalConfig::all(); c.min_rows = 0;); outside this crate a config is built from Default or ArrowMetalConfig::all and the with_* methods.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§min_rows: usize

Take a node only when its input has at least this many rows.

§accept_inexact: bool

Use an inexact (estimated) row count as if it were exact. Default: no.

§take_when_unknown: bool

Take a node whose input row count is unknown. Default: no (leave it).

§sort: bool

Full sorts: ORDER BY without LIMIT.

§topk: bool

Top-k: ORDER BY ... LIMIT (a sort with a fetch).

§aggregate: bool

Aggregates (GROUP BY, DISTINCT). Who runs a replaced one is aggregate_choice.

§filter: bool

Filters: a FilterExec whose predicate translates.

§aggregate_choice: AggregateChoice

Who runs a replaced aggregate. Default: AggregateChoice::Measured.

§table_rows: Option<usize>

Under AggregateChoice::Measured, look the measured table up at this row count instead of the input’s, at plan time and at run time (tests and experiments; default None).

§join: bool

Hash joins (HashJoinExec: inner, left, right on equal keys). Which ones is join_choice.

§join_choice: JoinChoice

Which translatable joins are replaced. Default: JoinChoice::Measured.

§report_plans: usize

The report keeps the decisions of the last this many plans the rule optimized (an EXPLAIN and each execution plan count one each), with the run-time decisions of their nodes. Default 64; 0 keeps one.

Implementations§

Source§

impl ArrowMetalConfig

Source

pub fn all() -> Self

Every shape the rule can translate (sorts, top-k, aggregates, filters, joins), at the default min_rows. Aggregates and joins are still decided by their measured tables unless aggregate_choice and join_choice say otherwise.

Source

pub fn with_min_rows(self, rows: usize) -> Self

Sets min_rows.

Source

pub fn with_accept_inexact(self, on: bool) -> Self

Source

pub fn with_take_when_unknown(self, on: bool) -> Self

Source

pub fn with_sort(self, on: bool) -> Self

Sets sort.

Source

pub fn with_topk(self, on: bool) -> Self

Sets topk.

Source

pub fn with_aggregate(self, on: bool) -> Self

Sets aggregate.

Source

pub fn with_filter(self, on: bool) -> Self

Sets filter.

Source

pub fn with_aggregate_choice(self, choice: AggregateChoice) -> Self

Source

pub fn with_table_rows(self, rows: Option<usize>) -> Self

Sets table_rows.

Source

pub fn with_join(self, on: bool) -> Self

Sets join.

Source

pub fn with_join_choice(self, choice: JoinChoice) -> Self

Source

pub fn with_report_plans(self, plans: usize) -> Self

Trait Implementations§

Source§

impl Clone for ArrowMetalConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ArrowMetalConfig

Source§

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

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

impl Default for ArrowMetalConfig

The default take-list, from the rule on/off measurement against DataFusion 55.1 on an M4 Max (16 partitions; MemTables of 8192-row batches and of one batch per partition; this crate with one totalOrder key per ORDER BY key and the chunked import; datafusion/results/datafusion_rule_2026-09-29.csv, rows crate = now; DataFusion alone / DataFusion with the rule, wall, best of 5, both layouts):

shape1M10M50Mdefault
ORDER BY int64 / Float64 / String / Float32 key, 3 columns5.9x - 12.8x19.2x - 28.7x18.9x - 27.2xtaken
the same over DataFusion’s Parquet scan (snappy, zstd)13.6x, 10.8x16.5x, 13.8xtaken
ORDER BY … LIMIT 100 (int64, Float64 DESC, Float32 DESC)0.14x - 0.49x0.24x - 0.41x0.17x - 0.29xleft
WHERE + whole-table sum/count (the filter is what is taken)0.56x - 0.59x0.62x - 0.72x0.74xleft
Parquet WHERE + GROUP BY0.52x - 0.53x0.54x - 0.55xleft

Full sorts at smaller inputs (every key type, both layouts): 100k rows 1.34x - 2.63x, 250k 2.64x - 4.80x, 500k 4.32x - 7.49x; the 1x crossover is below 100k for every key, and 250k is the first measured size at which every key type is at or above 2.6x; hence min_rows 250,000.

Top-k is left: DataFusion’s TopK answers LIMIT 100 over 50M rows in 4.6 - 6.5 ms; the rule’s GPU top-k takes 20 - 29 ms there, of which collecting the input stream alone is 6.5 - 8 ms.

Aggregates (GROUP BY, DISTINCT) are decided per shape and group count (AggregateChoice::Measured): the same SQL is ahead of DataFusion at some group counts and behind at others, and the rule sees the row count but not the group count (DataFusion’s MemTable and Parquet statistics carry no distinct counts). The rule replaces an aggregate when the measured table (src/agg_table.rs, generated by scripts/groupby_table.py from the sweep CSV it names) takes its shape at some group count at the input’s exact row count; the MetalExec then estimates the group count from a sample of the keys and runs on ArrowMetal only at a bucket the table takes, handing the node back to DataFusion otherwise. Hash joins are replaced where the measured join table (src/join_table.rs, generated by scripts/join_table.py from the join CSV it names) takes their join type, key type and build and probe row counts (JoinChoice::Measured).

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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