pub struct ScanParquet {
pub files: Vec<ScanFile>,
pub file_constant_columns: Vec<String>,
pub schema: SchemaRef,
}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:
- Metadata columns: if the field is annotated as a metadata column (e.g. via
StructField::create_metadata_columnwithMetadataColumnSpec::RowIndex), the engine populates it from the read context rather than from the Parquet file. See Metadata columns below. - File-constant columns: if the field’s name appears in
Self::file_constant_columns, the engine broadcasts the corresponding entry fromScanFile::file_constantsfor the file being read (not from Parquet bytes). See File-constant columns below. - 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::ParquetFieldIdmetadata, 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.
- Field ID: if the field carries a Parquet field ID via
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 (viaColumnMetadataKey::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 everyi.- Every name in
file_constant_columnsresolves to a field inschemathat is not a metadata column. - Each scalar in
file_constantsis compatible with its schema field’s type.
Fields§
§files: Vec<ScanFile>§file_constant_columns: Vec<String>§schema: SchemaRefTrait Implementations§
Source§impl Clone for ScanParquet
impl Clone for ScanParquet
Source§fn clone(&self) -> ScanParquet
fn clone(&self) -> ScanParquet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScanParquet
impl Debug for ScanParquet
Source§impl From<&ScanParquet> for ScanParquetNode
impl From<&ScanParquet> for ScanParquetNode
Source§fn from(node: &ScanParquet) -> Self
fn from(node: &ScanParquet) -> Self
Source§impl From<ScanParquet> for Operator
impl From<ScanParquet> for Operator
Source§fn from(payload: ScanParquet) -> Self
fn from(payload: ScanParquet) -> Self
Auto Trait Implementations§
impl Freeze for ScanParquet
impl RefUnwindSafe for ScanParquet
impl Send for ScanParquet
impl Sync for ScanParquet
impl Unpin for ScanParquet
impl UnsafeUnpin for ScanParquet
impl UnwindSafe for ScanParquet
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> AsAny for T
impl<T> AsAny for T
Source§fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)
fn any_ref(&self) -> &(dyn Any + Send + Sync + 'static)
dyn Any reference to the object: Read moreSource§fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ
fn as_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ
Arc<dyn Any> reference to the object: Read moreSource§fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>
fn into_any(self: Box<T>) -> Box<dyn Any + Send + Sync>
Box<dyn Any>: Read moreSource§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FoldWithOption for T
impl<T> FoldWithOption for T
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelTypewhere
ArrowType: TryFromKernel<KernelType>,
impl<KernelType, ArrowType> TryIntoArrow<ArrowType> for KernelTypewhere
ArrowType: TryFromKernel<KernelType>,
Source§fn try_into_arrow(self) -> Result<ArrowType, ArrowError>
fn try_into_arrow(self) -> Result<ArrowType, ArrowError>
arrow-conversion and (crate features arrow-conversion or declarative-plans or default-engine-base) only.Source§impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowTypewhere
KernelType: TryFromArrow<ArrowType>,
impl<KernelType, ArrowType> TryIntoKernel<KernelType> for ArrowTypewhere
KernelType: TryFromArrow<ArrowType>,
Source§fn try_into_kernel(self) -> Result<KernelType, ArrowError>
fn try_into_kernel(self) -> Result<KernelType, ArrowError>
arrow-conversion and (crate features arrow-conversion or declarative-plans or default-engine-base) only.