Package com.darkcollective.relix.optimizer.internal
package com.darkcollective.relix.optimizer.internal
The engine-side machinery behind
com.darkcollective.relix.optimizer: not exported by the published
artifact. What follows describes the package as a whole, as it stood before the split.
Query optimizer for Relix relational algebra expressions.
The optimizer takes a fully-analysed
SemanticModel and rewrites each
query's RelNode tree to a semantically
equivalent but more efficient form.
Core types
QueryOptimizer— entry point; applies all rule phases and returns per-queryOptimizationResults.OptimizationRule— interface implemented by every individual transformation rule.OptimizationCode— stable enumeration of every known rule, each with a unique code string and human-readable description.TransformationRecord— immutable record of a single rule firing: code, relation name, detail, and source location.OptimizationContext— mutable collector that accumulates records during an optimization run.OptimizationResult— immutable result for one query: original tree, optimized tree, and the list of transformations applied.- the console's optimization report —
renders an 80-column audit report in the same style as
IrReport.
-
ClassDescriptionColumn pruning (
PROJ-004) — narrows the rows flowing out of every base relation to the columns the query actually reads.Answers, for a pipeline rule, whether an expression evaluates to the same relation every time it is run.Optimization pass for the twoδ(DISTINCT) elimination rules: one looks down from theδ(DIST-001), the other looks up from it (DIST-002).Optimization pass that converts Cartesian products with selections into theta joins, and pushes one-sided selections into join inputs (JOIN-001andJOIN-002).Which input of a binary join owns an attribute reference.Optimization pass that decorrelates an uncorrelatedLATERALjoin — one whose table-valued-function arguments never reference the outer row (LATERAL-001).Mutable accumulator forTransformationRecords produced during a query optimization run.The optimizer's rule registry and its bounded fixpoint driver.One group of rules, applied in order and re-applied while they keep making progress.The immutable result of optimizing a single query'sRelNodetree.A single query-optimization transformation rule.Outer-join demotion (JOIN-004) — turning an outer join into a less outer one when a filter above it makes the padded rows unreachable.The registry entry for one optimizer pass — anOptimizationRulewhosePassRule.apply(com.darkcollective.relix.ast.RelNode, java.lang.String, com.darkcollective.relix.semantic.SchemaAnnotations, com.darkcollective.relix.optimizer.internal.OptimizationContext)delegates to that pass.Utility that collects allAttributeOperandnames referenced anywhere in aPredicatetree.Entry point for the Relix query optimizer.Optimization pass that eliminates a redundant outer aggregation stacked directly on top of another aggregation (AGG-001).Rename elimination (RENAME-001…RENAME-004) — the cleanup pass that runs immediately afterViewInliner.The predicate that keeps exactly the rows a selection drops.Partition-pruning pass (ADR-0020) for the two time-series operators (SESSION-001/DOWNSAMPLE-001).Cleanup pass that puts selections back together — the two rules that turn several filters into one.Optimization pass that moves selections (σ) closer to their source relations, reducing the number of tuples flowing through intermediate operators (SEL-003..009).Optimization pass that decomposes every conjunctive selection predicate into two stacked selections, enabling each factor to be pushed independently (SEL-001).Transitive equality propagation (EQ-001) — the law that turns a one-sided filter into a filter on both sources.Expands references to named views into the views' bodies, so that the rule passes can optimise across former view boundaries (e.g.