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.
- Auto
Partition Rule - AQE rule that adjusts the bucket count of
HashandRoundRobinexchange nodes based on the observed data volume from the previous execution. - Broadcast
Auto Rule - Logical optimizer rule that marks small scan nodes as broadcast-eligible.
- Broadcast
Runtime Rule - AQE rule that promotes or demotes broadcast joins based on the observed output size from the previous execution.
- CboCost
Model - NDV-aware cost model.
- Coalesce
Advice - Advice returned by the coalesce rule: which partition indices should be merged.
- Coalesce
Rule - Merges partitions whose
memory_bytesfalls belowmin_partition_bytes. - Column
CboStats - Per-column statistics collected by
ANALYZE TABLE … FOR COLUMNS. - Constant
Folding Rule - 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).
- Dynamic
Partition Pruning Rule - AQE rule that injects a runtime filter on the probe side of a star-schema join, sourced from the build side’s distinct values.
- File
Stats - Per-file metadata used by
SmallFilePlanner. - Join
Reorder Rule - Logical optimizer rule that puts the smaller table on the left of commutative joins.
- Optimize
Result - The result of running the optimizer over a logical plan.
- Optimizer
- Rule-based optimizer for Krishiv logical plans.
- Predicate
Pushdown Rule - Push
Filterpredicates down intoTableScannodes. - Runtime
Stats - Runtime statistics collected by an executor stage.
- Skew
Advice - Advice returned by the skew-join rule: which partition indices should be split and what salting factor to use.
- Skew
Join Rule - AQE rule that splits hot partitions of a HashJoin’s probe side using salting, and replicates the build side accordingly.
- Small
File Planner - Plans scan parallelism for a set of files.
- Split
Plan Advice - Advice produced by
SmallFilePlanner: a list of scan groups where each group of file paths should be handled by a single executor task. - Static
Cost Model - Static, row-count-aware cost model for logical plans.
- Streaming
AqeGuard - Guards streaming plans from AQE rules that would change partition count.
- Table
CboStats - Catalog statistics the cost model needs for one table.
- Table
Stats Registry - Threshold
Skew Rule - Detects hot partitions whose
input_rowsexceedsthreshold × median_rows.
Enums§
- Optimizer
Error - 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. - Cost
Model - Estimates the cost of executing a
LogicalPlan. - Optimizer
Rule - A rule that transforms a
LogicalPlaninto a (possibly better) one. - Skew
Rule - 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_optimizerwhose coalescing will not drop a stage belowmin_partitionspartitions.- default_
aqe_ optimizer_ with_ stats default_aqe_optimizerbacked by the process-global table statistics registry (Phase 54): cold-start estimates useCboCostModelover stats collected byANALYZE TABLE/ Iceberg auto-stats instead of the static per-operator coefficients.- default_
aqe_ optimizer_ with_ stats_ and_ parallelism default_aqe_optimizer_with_statswith a coalescing parallelism floor.- default_
logical_ optimizer - global_
table_ stats - Process-global table statistics registry (Phase 54).
Type Aliases§
- Optimizer
Result - Result type for logical and adaptive optimizer pipelines.