pub trait RegionScanner:
Debug
+ DisplayAs
+ Send {
Show 17 methods
// Required methods
fn name(&self) -> &str;
fn properties(&self) -> &ScannerProperties;
fn schema(&self) -> SchemaRef;
fn metadata(&self) -> RegionMetadataRef;
fn prepare(&mut self, request: PrepareRequest) -> Result<(), BoxedError>;
fn scan_partition(
&self,
ctx: &QueryScanContext,
metrics_set: &ExecutionPlanMetricsSet,
partition: usize,
) -> Result<SendableRecordBatchStream, BoxedError>;
fn has_predicate_without_region(&self) -> bool;
fn add_dyn_filter_to_predicate(
&mut self,
filter_exprs: Vec<Arc<dyn PhysicalExpr>>,
) -> Vec<bool>;
fn set_logical_region(&mut self, logical_region: bool);
fn set_query_load_region_id(&mut self, region_id: RegionId);
// Provided methods
fn raw_series_schema(
&self,
_label_source: &RawLabelSource,
) -> Result<Option<Arc<SeriesSchema>>, BoxedError> { ... }
fn raw_series_has_explicit_labels(
&self,
_labels: &RawLabelSource,
) -> Result<bool, BoxedError> { ... }
fn raw_series_ordering(&self) -> Result<SeriesOrdering, BoxedError> { ... }
fn scan_series_partition(
&self,
_ctx: &QueryScanContext,
_metrics_set: &ExecutionPlanMetricsSet,
_partition: usize,
_label_source: &RawLabelSource,
) -> Result<Option<SendableRawSeriesStream>, BoxedError> { ... }
fn prepare_series(
&self,
_ctx: &QueryScanContext,
_metrics_set: &ExecutionPlanMetricsSet,
_label_source: &RawLabelSource,
) -> BoxFuture<'static, Result<Option<Arc<dyn PreparedSeriesSource>>, BoxedError>> { ... }
fn reset_state(&mut self) { ... }
fn snapshot_sequence(&self) -> Option<SequenceNumber> { ... }
}Expand description
A scanner that provides a way to scan the region concurrently.
The scanner splits the region into partitions so that each partition can be scanned concurrently.
You can use this trait to implement an ExecutionPlan.
Required Methods§
fn name(&self) -> &str
Sourcefn properties(&self) -> &ScannerProperties
fn properties(&self) -> &ScannerProperties
Returns the properties of the scanner.
Sourcefn metadata(&self) -> RegionMetadataRef
fn metadata(&self) -> RegionMetadataRef
Returns the metadata of the region.
Sourcefn prepare(&mut self, request: PrepareRequest) -> Result<(), BoxedError>
fn prepare(&mut self, request: PrepareRequest) -> Result<(), BoxedError>
Prepares the scanner with the given partition ranges.
This method is for the planner to adjust the scanner’s behavior based on the partition ranges.
Sourcefn scan_partition(
&self,
ctx: &QueryScanContext,
metrics_set: &ExecutionPlanMetricsSet,
partition: usize,
) -> Result<SendableRecordBatchStream, BoxedError>
fn scan_partition( &self, ctx: &QueryScanContext, metrics_set: &ExecutionPlanMetricsSet, partition: usize, ) -> Result<SendableRecordBatchStream, BoxedError>
Scans the partition and returns a stream of record batches.
§Panics
Panics if the partition is out of bound.
Sourcefn has_predicate_without_region(&self) -> bool
fn has_predicate_without_region(&self) -> bool
Check if there is any predicate exclude region partition exprs that may be executed in this scanner.
Sourcefn add_dyn_filter_to_predicate(
&mut self,
filter_exprs: Vec<Arc<dyn PhysicalExpr>>,
) -> Vec<bool>
fn add_dyn_filter_to_predicate( &mut self, filter_exprs: Vec<Arc<dyn PhysicalExpr>>, ) -> Vec<bool>
Add the given dynamic filter expressions to the predicate of the scanner. Returns a vector of booleans indicating which filter expressions were applied. true indicates the filter expression was applied(will be use by scanner to prune by stat for row group), false otherwise.
Sourcefn set_logical_region(&mut self, logical_region: bool)
fn set_logical_region(&mut self, logical_region: bool)
Sets whether the scanner reads one logical metric region, including a physical metric region constrained by a table-ID filter.
Sourcefn set_query_load_region_id(&mut self, region_id: RegionId)
fn set_query_load_region_id(&mut self, region_id: RegionId)
Sets the region id that should receive query-load metrics.
Provided Methods§
Sourcefn raw_series_schema(
&self,
_label_source: &RawLabelSource,
) -> Result<Option<Arc<SeriesSchema>>, BoxedError>
fn raw_series_schema( &self, _label_source: &RawLabelSource, ) -> Result<Option<Arc<SeriesSchema>>, BoxedError>
Checks whether this scanner can provide a raw-series scan for the given labels.
This is a non-consuming preflight: it must not start a scan or otherwise consume
scanner state. It checks immutable label binding, schema, and typed residual-predicate
eligibility. Returning Some requires overriding scan_series_partition and
promises that it can execute with this label source. None means the raw path is
unsupported and an ordinary scan remains available. Execution must revalidate and
return errors rather than falling back if the binding or schema changed since preflight.
Sourcefn raw_series_has_explicit_labels(
&self,
_labels: &RawLabelSource,
) -> Result<bool, BoxedError>
fn raw_series_has_explicit_labels( &self, _labels: &RawLabelSource, ) -> Result<bool, BoxedError>
Whether raw chunks carry complete explicit labels under this scan binding. This non-consuming declaration must agree with the stream before its first poll. Returning true does not replace the immutable source binding or authorization checks.
Sourcefn raw_series_ordering(&self) -> Result<SeriesOrdering, BoxedError>
fn raw_series_ordering(&self) -> Result<SeriesOrdering, BoxedError>
Returns the guarantee for subsequent raw scans without consuming scanner state.
Legacy raw sources have no ordering declaration, so Contiguous is the conservative
default; Interleaved is not representable on the raw frame wire.
Sourcefn scan_series_partition(
&self,
_ctx: &QueryScanContext,
_metrics_set: &ExecutionPlanMetricsSet,
_partition: usize,
_label_source: &RawLabelSource,
) -> Result<Option<SendableRawSeriesStream>, BoxedError>
fn scan_series_partition( &self, _ctx: &QueryScanContext, _metrics_set: &ExecutionPlanMetricsSet, _partition: usize, _label_source: &RawLabelSource, ) -> Result<Option<SendableRawSeriesStream>, BoxedError>
Scans a partition as raw series when this source supports that path.
None means raw capability is absent before execution and permits a legacy scan instead.
Some selects this entrypoint, including for an empty successful stream. Errors propagate;
callers must not replay a failed raw scan through the legacy path. Use only one entrypoint
for a given scanner partition per execution. The explicit label source is owned by the
returned stream and must be bound to this scanner’s metadata snapshot.
Output preserves the ordinary storage reader’s pushdown and MVCC semantics. Inexact
pushed-down predicates can leave false-positive candidates, just as in scan_partition.
Implementations must preserve typed residual-predicate semantics before any lossy value
conversion, or return None before execution when they cannot. Callers must retain
residual predicate columns until those predicates are evaluated and apply the final
projection afterward; raw capability does not mean filtering is complete.
§Panics
The default implementation panics. Implementations must override this method to support raw series scanning.
Sourcefn prepare_series(
&self,
_ctx: &QueryScanContext,
_metrics_set: &ExecutionPlanMetricsSet,
_label_source: &RawLabelSource,
) -> BoxFuture<'static, Result<Option<Arc<dyn PreparedSeriesSource>>, BoxedError>>
fn prepare_series( &self, _ctx: &QueryScanContext, _metrics_set: &ExecutionPlanMetricsSet, _label_source: &RawLabelSource, ) -> BoxFuture<'static, Result<Option<Arc<dyn PreparedSeriesSource>>, BoxedError>>
Prepares scanner-wide candidates once for independent ordinal-range reads.
Metadata I/O is asynchronous; sample payloads are loaded only by polling readers.
The owned future does not borrow the scanner. None means unsupported before
execution; errors must propagate without replay through a different scan path.
Implementations may share preparation with their raw partition adapter.
Sourcefn reset_state(&mut self)
fn reset_state(&mut self)
Resets execution state after streams from the previous execution have been dropped.
Callers must not concurrently execute, reset, or install filters through scanner aliases. Implementations retaining dynamic predicates must discard them and derived pruning state, while preserving static predicates, the source snapshot, and prepared properties. The default is a no-op and does not make inherently one-shot sources replayable.
fn snapshot_sequence(&self) -> Option<SequenceNumber>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".