Skip to main content

Module optimizer

Module optimizer 

Source
Expand description

Query optimizer traits and infrastructure for Krishiv.

This crate defines the rule-based optimizer framework used by both the logical and physical planning pipelines, as well as the AQE (Adaptive Query Execution) extension traits that operate on runtime statistics collected during stage execution.

Structs§

AqeOptimizer
AQE optimizer that automatically skips partition-changing rules for streaming plans.
AutoPartitionRule
AQE rule that adjusts the bucket count of Hash and RoundRobin exchange nodes based on the observed data volume from the previous execution.
BroadcastAutoRule
Logical optimizer rule that marks small scan nodes as broadcast-eligible.
BroadcastRuntimeRule
AQE rule that promotes or demotes broadcast joins based on the observed output size from the previous execution.
CboCostModel
NDV-aware cost model.
CoalesceAdvice
Advice returned by the coalesce rule: which partition indices should be merged.
CoalesceRule
Merges partitions whose memory_bytes falls below min_partition_bytes.
ColumnCboStats
Per-column statistics collected by ANALYZE TABLE … FOR COLUMNS.
ConstantFoldingRule
Optimizer rule that folds constant sub-expressions inside filter predicates and removes always-true / always-false filters.
Cost
Estimated cost of executing a plan.
DppAdvice
Advice produced by the DPP rule: the join keys and the build-side side of the join (the small side whose distinct values feed the filter).
DynamicPartitionPruningRule
AQE rule that injects a runtime filter on the probe side of a star-schema join, sourced from the build side’s distinct values.
FileStats
Per-file metadata used by SmallFilePlanner.
JoinReorderRule
Logical optimizer rule that puts the smaller table on the left of commutative joins.
OptimizeResult
The result of running the optimizer over a logical plan.
Optimizer
Rule-based optimizer for Krishiv logical plans.
PredicatePushdownRule
Push Filter predicates down into TableScan nodes.
RuntimeStats
Runtime statistics collected by an executor stage.
SkewAdvice
Advice returned by the skew-join rule: which partition indices should be split and what salting factor to use.
SkewJoinRule
AQE rule that splits hot partitions of a HashJoin’s probe side using salting, and replicates the build side accordingly.
SmallFilePlanner
Plans scan parallelism for a set of files.
SplitPlanAdvice
Advice produced by SmallFilePlanner: a list of scan groups where each group of file paths should be handled by a single executor task.
StaticCostModel
Static, row-count-aware cost model for logical plans.
StreamingAqeGuard
Guards streaming plans from AQE rules that would change partition count.
TableCboStats
Catalog statistics the cost model needs for one table.
TableStatsRegistry
ThresholdSkewRule
Detects hot partitions whose input_rows exceeds threshold × median_rows.

Enums§

OptimizerError
Errors produced while validating or executing optimizer rules.

Constants§

DEFAULT_BROADCAST_THRESHOLD_ROWS
Default threshold for auto-broadcast: tables with estimated rows below this value are candidates for broadcast join. ~1M rows ≈ 100 MiB at 100 bytes/row.
DEFAULT_MAX_BROADCAST_BYTES
Default maximum observed output size for runtime broadcast promotion: 64 MiB.
DEFAULT_SALT_FACTOR
Default salting factor when a hot partition is detected.
DEFAULT_SKEW_THRESHOLD
Default median-multiplier threshold (1 + the relative overshoot).
DPP_MAX_BUILD_ROWS
Maximum number of build-side rows after which DPP is no longer worth the cost of building, serialising, and pushing the filter.
DPP_MAX_KEYS
Maximum number of distinct keys the filter retains.

Traits§

AqeRule
An Adaptive Query Execution rule that re-plans based on RuntimeStats.
CostModel
Estimates the cost of executing a LogicalPlan.
OptimizerRule
A rule that transforms a LogicalPlan into a (possibly better) one.
SkewRule
A rule that detects skewed (hot) partitions from RuntimeStats.

Functions§

default_aqe_optimizer
Default AQE optimizer with guarded coalescing and the streaming guard.
default_aqe_optimizer_with_parallelism
default_aqe_optimizer whose coalescing will not drop a stage below min_partitions partitions.
default_aqe_optimizer_with_stats
default_aqe_optimizer backed by the process-global table statistics registry (Phase 54): cold-start estimates use CboCostModel over stats collected by ANALYZE TABLE / Iceberg auto-stats instead of the static per-operator coefficients.
default_aqe_optimizer_with_stats_and_parallelism
default_aqe_optimizer_with_stats with a coalescing parallelism floor.
default_logical_optimizer
global_table_stats
Process-global table statistics registry (Phase 54).

Type Aliases§

OptimizerResult
Result type for logical and adaptive optimizer pipelines.