pub struct ParquetTableSpec {
pub name: String,
pub path: String,
pub primary_key: Vec<String>,
}Expand description
A parquet table to plan against, and what is known to be true about it.
primary_key is an informational constraint, in the sense Spark and
Databricks use the word (RELY): the engine does not verify it, it trusts
it. Declaring a key that does not hold changes results, exactly as a wrong
RELY constraint does there. It is empty by default, so a caller that says
nothing gets the previous behaviour.
§Why the engine wants to be told
DataFusion already derives FunctionalDependencies from a provider’s
constraints, and optimize_projections already uses
get_required_group_by_exprs_indices to shrink a GROUP BY to the minimal
functionally-equivalent subset. All of that machinery is live and does
nothing here, because a parquet file carries no key and every table we
register declares none — so the dependency set is always empty.
§What this does and does NOT buy — read before assuming
DataFusion’s rule keeps (columns the parent requires) ∪ (minimal FD subset). So a declared key removes a column from a GROUP BY only when
nothing downstream selects it. That is a real and common shape —
GROUP BY a, b projecting only a — and it is what
a_declared_primary_key_shrinks_the_group_by proves.
It is not TPC-H q10’s shape. q10 selects all seven grouped columns, so
the parent requires them and no key declaration can prune them. Measured
2026-07-31: rewriting q10 to carry only the key is worth 14.8x
(1784.6 s → 120.9 s; the orders⋈customer stage alone 8,968 → 38.9
task-seconds), but capturing that needs late materialisation —
aggregate on the key, take the top N, then re-join for the display columns.
DataFusion has no such rule and neither do we. Declaring a key is a
precondition for writing one, not a substitute.
The 230x on that stage is superlinear in the columns rather than the bytes:
per-row string handling (hashing and copying ~227 B rows), which is why
neither bandwidth nor fetch concurrency moved it
(q10-dist-s2-is-the-whole-query).
Fields§
§name: StringName the query refers to the table by.
path: StringSingle parquet file or a directory dataset; local or object storage.
primary_key: Vec<String>Columns that jointly form a primary key, if the caller declares one.
Implementations§
Trait Implementations§
Source§impl Clone for ParquetTableSpec
impl Clone for ParquetTableSpec
Source§fn clone(&self) -> ParquetTableSpec
fn clone(&self) -> ParquetTableSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ParquetTableSpec
impl RefUnwindSafe for ParquetTableSpec
impl Send for ParquetTableSpec
impl Sync for ParquetTableSpec
impl Unpin for ParquetTableSpec
impl UnsafeUnpin for ParquetTableSpec
impl UnwindSafe for ParquetTableSpec
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§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