Skip to main content

DynamicScan

Struct DynamicScan 

Source
pub struct DynamicScan {
    pub schema: SchemaRef,
    pub file_type: FileType,
    pub base_url: Url,
    pub file_constant_columns: Vec<String>,
    pub path_column: ColumnName,
    pub file_size_column: ColumnName,
    pub last_modified_column: ColumnName,
    pub dv_column: ColumnName,
}
Available on crate feature declarative-plans only.
Expand description

Reads data files from an upstream stream of file-metadata tuples, one input row per file. For each row, the path, size, and last-modified columns describe the file; the engine resolves its path against base_url (see below), opens it as file_type, and reads columns matching schema.

file_constant_columns lists upstream columns whose per-file values are broadcast onto every emitted file row. This is file-constant metadata, the same concept as ScanParquet::file_constant_columns. Each named input field must have the same type and nullability as its output field. See the example below.

dv_column names a nullable column on the upstream row holding a Delta DeletionVectorDescriptor struct. The engine resolves it into a roaring bitmap and drops file rows whose row index appears in the DV. A NULL value for a given input row means “no DV for this file”, so all file rows are emitted.

Each path value is resolved against base_url via Url::join. URL-reference resolution need not stay under base_url: a different-scheme absolute URL replaces the base, while a value starting with / or // replaces its path or authority.

Output row order is unspecified: the engine is free to read files in any order, in parallel, and to interleave rows from different files. The relative order of upstream rows is not preserved.

§Example

Given an upstream metadata stream and a DynamicScan configuration:

upstream (metadata)
    path             | size | filemod | version | dv
    -----------------+------+---------+---------+------
    part-0.parquet   | 1024 |  100000 |       7 | NULL
    part-1.parquet   | 2048 |  200000 |       8 | NULL
DynamicScan {
    schema: { id: int, name: string, version: long },
    file_type: Parquet,
    base_url: "s3://table/",
    file_constant_columns: ["version"],
    path_column: "path",
    file_size_column: "size",
    last_modified_column: "filemod",
    dv_column: "dv",
}

The engine opens s3://table/part-0.parquet and s3://table/part-1.parquet, reads {id, name} from each, sees a NULL DV for each file so all rows survive, and broadcasts the row’s version onto every emitted file row. One possible output (row order is not guaranteed):

    | id | name | version
    +----+------+--------
    |  3 |  c   |       8
    |  2 |  b   |       7
    |  4 |  d   |       8
    |  1 |  a   |       7

Fields§

§schema: SchemaRef§file_type: FileType§base_url: Url

Hierarchical base URL ending in / against which per-row path values resolve.

§file_constant_columns: Vec<String>§path_column: ColumnName

Non-nullable input column holding the per-row file path or URL fragment.

§file_size_column: ColumnName

Non-nullable input column with the file’s total size in bytes.

§last_modified_column: ColumnName

Non-nullable input column with the last-modified timestamp in milliseconds since epoch.

§dv_column: ColumnName

Nullable input column with the schema of DeletionVectorDescriptor.

Implementations§

Source§

impl DynamicScan

Source

pub fn try_new( input_schema: &SchemaRef, output_schema: impl Into<SchemaRef>, file_type: FileType, base_url: Url, file_constant_columns: impl IntoIterator<Item = impl Into<String>>, path_column: ColumnName, file_size_column: ColumnName, last_modified_column: ColumnName, dv_column: ColumnName, ) -> DeltaResult<Self>

Constructs a DynamicScan whose emitted rows match output_schema.

input_schema describes the upstream rows containing file metadata. The scan reads file_type files relative to base_url.

§Errors

Returns an error when base_url is not hierarchical or does not end in /; when a required metadata or deletion-vector column is absent from input_schema, has an incompatible type, or has invalid nullability; or when a file-constant column is absent from either schema, is a metadata column, or has different input and output types or nullability.

Source

pub fn validate_input(&self, input_schema: &SchemaRef) -> DeltaResult<()>

Validates the columns consumed by this scan against an upstream input_schema.

Returns Ok(()) when the base URL is valid and every configured column resolves with the required type and nullability.

§Errors

Returns an error when base_url is not hierarchical or does not end in /; when a required metadata or deletion-vector column is absent, has an incompatible type, or has invalid nullability; or when a file-constant column is absent from either schema, is a metadata column, or has different input and output types or nullability.

Trait Implementations§

Source§

impl Clone for DynamicScan

Source§

fn clone(&self) -> DynamicScan

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 DynamicScan

Source§

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

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

impl From<&DynamicScan> for DynamicScanNode

Source§

fn from(node: &DynamicScan) -> Self

Converts to this type from the input type.
Source§

impl From<DynamicScan> for Operator

Source§

fn from(payload: DynamicScan) -> 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