Skip to main content

exact_sequence_range

Function exact_sequence_range 

Source
pub(crate) fn exact_sequence_range(
    request: &ScanRequest,
    version: &Version,
) -> Result<(Vec<FileHandle>, Option<SequenceRange>)>
Expand description

Selects the SST files for a scan and, when requested, determines whether the selected files support an exact sequence-range scan.

Files excluded by the request time range are not selected: (C, H] rows are a subset of the query’s time-range rows, so a time-pruned file cannot contribute a row to (C, H].

Unmarked local files use FileMeta.sequence as an admission barrier rather than a row maximum. Compaction and edit assign it as committed_sequence + 1; C >= barrier proves Flow has already consumed the entire file, so such a file is excluded before the capability check.

A foreign file is different: the parquet reader virtualizes every row to its target-local FileMeta.sequence. Consequently, a present sequence is the only trust requirement for a foreign file; its source marker is irrelevant. A foreign file without that barrier is retained as a failed-closed error so it cannot be mistaken for a local sequence domain. This check is performed even when another exact-range capability condition would return None.