Skip to main content

ScanParquet

Struct ScanParquet 

Source
pub struct ScanParquet {
    pub files: Vec<ScanFile>,
    pub file_constant_columns: Vec<String>,
    pub schema: SchemaRef,
}
Available on crate feature declarative-plans only.
Expand description

Reads Parquet files into row batches matching schema. The engine returns exactly the columns named by schema, in schema order.

Output row order is unspecified: the engine is free to read files in any order, in parallel, and to interleave rows from different files.

§Column resolution

The engine iterates schema’s fields in order; for each field it produces one column of output:

  1. Metadata columns: if the field is annotated as a metadata column (e.g. via StructField::create_metadata_column with MetadataColumnSpec::RowIndex), the engine populates it from the read context rather than from the Parquet file. See Metadata columns below.
  2. File-constant columns: if the field’s name appears in Self::file_constant_columns, the engine broadcasts the corresponding entry from ScanFile::file_constants for the file being read (not from Parquet bytes). See File-constant columns below.
  3. Data columns: otherwise the engine attempts to locate the field in the Parquet file, in this order:
    • Field ID: if the field carries a Parquet field ID via ColumnMetadataKey::ParquetFieldId metadata, match it against the Parquet column with the same field id.
    • Field name: otherwise, or if no Parquet column has the requested field id, match by column name.
    • No match: the output column is filled with NULLs when the field is nullable, or an error is returned when it is non-nullable.

Parquet columns not referenced by any schema field are ignored.

§Example

Consider a schema with the following fields (none of which are metadata columns):

  • Column 0: "i_logical" (integer, non-null) with field ID 1 (via ColumnMetadataKey::ParquetFieldId)
  • Column 1: "s" (string, nullable) with no field ID metadata
  • Column 2: "i2" (integer, nullable) with no field ID metadata

And a Parquet file containing these columns:

  • Column 0: "i2" (integer, nullable) with field ID 3
  • Column 1: "i" (integer, non-null) with field ID 1
  • No "s" column present

Resolving each schema field in turn:

  • "i_logical" matches "i" by field ID (both have ID 1).
  • "s" has no matching Parquet column, so the output column is filled with NULLs.
  • "i2" matches "i2" by column name (no field ID to match on).

The returned data contains exactly 3 columns in schema order: {i_logical: parquet[1], s: NULL.., i2: parquet[0]}.

§Metadata columns

A field marked as a row index metadata column (via StructField::create_metadata_column with MetadataColumnSpec::RowIndex) is populated by the engine with the 0-based row position within the file (LONG, non-nullable); a file with 5 rows yields [0, 1, 2, 3, 4]. The column name is caller-chosen (commonly "row_index").

§File-constant columns

Self::file_constant_columns names output fields whose values are identical for every row in a given file (for example Delta partition columns or a table-changes version). Types and nullability come from Self::schema; ScanFile::file_constants supplies the per-file literals in the same order as file_constant_columns.

File-constant columns are distinct from metadata columns, which are engine-generated (such as row index). DynamicScan::file_constant_columns is the same concept for the DynamicScan node.

§Invariants

  • files[i].file_constants.len() == file_constant_columns.len() for every i.
  • Every name in file_constant_columns resolves to a field in schema that is not a metadata column.
  • Each scalar in file_constants is compatible with its schema field’s type.

Fields§

§files: Vec<ScanFile>§file_constant_columns: Vec<String>§schema: SchemaRef

Trait Implementations§

Source§

impl Clone for ScanParquet

Source§

fn clone(&self) -> ScanParquet

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 ScanParquet

Source§

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

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

impl From<&ScanParquet> for ScanParquetNode

Source§

fn from(node: &ScanParquet) -> Self

Converts to this type from the input type.
Source§

impl From<ScanParquet> for Operator

Source§

fn from(payload: ScanParquet) -> Self

Converts to this type from the input type.

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> AsAny for T
where T: Any + Send + Sync,

Source§

fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)

Obtains a dyn Any reference to the object: Read more
Source§

fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Obtains an Arc<dyn Any> reference to the object: Read more
Source§

fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts the object to Box<dyn Any>: Read more
Source§

fn type_name(&self) -> &'static str

Convenient wrapper for std::any::type_name, since Any does not provide it and Any::type_id is useless as a debugging aid (its Debug is just a mess of hex digits).
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, 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> FoldWithOption for T

Source§

fn fold_with<U>(self, opt: Option<U>, f: impl FnOnce(Self, U) -> Self) -> Self

Available on crate feature internal-api only.
Applies an optional fold operation f to self if opt is Some; otherwise returns self unchanged. Read more
Source§

fn try_fold_with<U, E>( self, opt: Option<U>, f: impl FnOnce(Self, U) -> Result<Self, E>, ) -> Result<Self, E>

Available on crate feature internal-api only.
Fallible fold_with: applies Result-returning f to self if opt is Some, otherwise returns self unchanged (wrapped in Ok).
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelType
where ArrowType: TryFromKernel<KernelType>,

Source§

fn try_into_arrow(self) -> Result<ArrowType, ArrowError>

Available on crate feature arrow-conversion and (crate features arrow-conversion or declarative-plans or default-engine-base) only.
Source§

impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowType
where KernelType: TryFromArrow<ArrowType>,

Source§

fn try_into_kernel(self) -> Result<KernelType, ArrowError>

Available on crate feature arrow-conversion and (crate features arrow-conversion or declarative-plans or default-engine-base) only.
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