Skip to main content

build_reader_filter_plan

Function build_reader_filter_plan 

Source
pub(crate) fn build_reader_filter_plan(
    predicate: Option<&Predicate>,
    expected_metadata: Option<&RegionMetadata>,
    pre_filter_mode: PreFilterMode,
    read_format: &FlatReadFormat,
    parquet_schema: &SchemaDescriptor,
    codec: &Arc<dyn PrimaryKeyCodec>,
) -> ReaderFilterPlan
Expand description

Splits a query [Predicate] into a ReaderFilterPlan: predicates that can run during the prefilter pass (on a reduced projection, to compute a refined row selection) versus predicates that must run on the normal read path (alongside the full projection).

The prefilter pass is best-effort pruning: a physical-filter predicate is silently dropped when PhysicalFilterContext::new_opt returns None (column not in the projected arrow schema). This is safe because the DataFusion FilterExec above the reader always re-applies the original predicate, so the prefilter pass is purely a pruning hint.

Tag and timestamp predicates that lower to [SimpleFilterEvaluator] are an exception — the engine enforces them precisely, so the prefilter pass is the only place they execute. They are never silently dropped.