Package com.darkcollective.relix.plan


package com.darkcollective.relix.plan
The physical plan: what the engine will run.

PhysicalNode is the plan tree, one record per physical operator. PlanEstimates carries each node's estimated row count beside the tree rather than inside it, and PlannedQuery pairs the two, as Relation.plan() returns them.

  • Class
    Description
    What a PhysicalNode.Scan over an HTTP source has folded into its request — a query λ bound to the source's declared paginate limit, and σ equalities bound to the source's IN columns (a query parameter or a path segment).
    A node in a physical query plan — the executable form of a logical RelNode tree, produced by the Planner.
    Aggregation (γ) — groups by groupingKeys and reduces each group with aggregates.
    AS-OF join — a temporal "pick the nearest right row by time" join.
    Bernoulli sampling (SAMPLE p [SEED n]): keeps each row of input independently with probability probability.
    Which input a join materialises (hashes, or buffers for nested-loop).
    Transitive closure (least fixpoint) of the input edge relation over PhysicalNode.Closure.fromColumn()/PhysicalNode.Closure.toColumn().
    Connected-components labelling (CLUSTER) of the input edge relation, read as undirected edges over PhysicalNode.Cluster.fromColumn()/PhysicalNode.Cluster.toColumn().
    Constructive covering reduction (COVER, constructive mode): builds candidate rows value-by-value over the PhysicalNode.ConstructiveCover.factors domains, using PhysicalNode.ConstructiveCover.conjuncts as a validity oracle, never materialising the full Cartesian product.
    Covering reduction (COVER): keeps a near-minimal subset of input rows such that every distinct t-column value combination (PhysicalNode.Cover.strength-way tuple) occurring in the input occurs in the output.
    Distinct (δ) — eliminates duplicate rows.
     
    Time-series downsampling (DOWNSAMPLE): groups input rows into fixed-width time buckets and consolidates numeric columns using the chosen ConsolidationFunction.
    Produces no rows at all, under schema's heading — the physical form of EmptyRelationNode, planted by the optimizer where a sub-tree was proved unsatisfiable.
    General monotone recursion (FIX): computes the semi-naïve least-fixpoint of PhysicalNode.Fixpoint.step() seeded by PhysicalNode.Fixpoint.base(), with the relation named PhysicalNode.Fixpoint.name() bound to the current delta during each step evaluation.
    Interval join — tests each pair of rows against an Allen interval algebra relation.
    Replace-each-round iteration (ITERATE): evaluates PhysicalNode.Iterate.base(), then evaluates PhysicalNode.Iterate.step() with the relation named PhysicalNode.Iterate.name() bound to the previous round's whole output, replacing it each round, until PhysicalNode.Iterate.stop() is satisfied.
    A join of any kind, carrying the chosen physical strategy.
    How a join is executed.
    Equi-join key columns: left.get(i) and right.get(i) are the positions, in the left and right inputs, of the i-th equated column pair.
    The join flavour.
    Lateral / correlated table-valued function join: for each row of PhysicalNode.LateralJoin.left(), evaluates the PhysicalNode.LateralJoin.arguments() in that row's context, binds them into the function body via PhysicalNode.LateralJoin.bodyBuilder(), plans the instantiated body, and concatenates the left row with each row the body produces.
    Limit (λ) — takes a prefix of the input; preserves the input's delivered ordering.
    Declarative optimisation (OPTIMIZE): within each group (by groupingKeys) either selects the optimal subset (MIP, when allocation is empty) or assigns continuous allocations (LP, when allocation is present).
    Bounded variable-length path reachability (PATH) over the input edge relation, read over PhysicalNode.Path.fromColumn()/PhysicalNode.Path.toColumn() as directed edges, or as undirected ones when PhysicalNode.Path.undirected().
    Rows-to-columns rotation (PIVOT): groups the input by the optional groupKeys, then turns each distinct value of keyColumn into a new output column whose cell is the corresponding valueColumn cell (NULL when the group has no row for that key).
    Projection (π) — computes attributes from each row, streaming.
    A leaf that pushes a relational sub-expression down to a connector as a single native query.
    A reference to the relation bound by an enclosing PhysicalNode.Fixpoint or PhysicalNode.Iterate.
    Relation/column rename — a metadata-only relabel to PhysicalNode.Rename.schema().
    Reservoir (fixed-count) sampling (SAMPLE … ROWS [SEED n]): keeps exactly count rows of input, chosen uniformly at random without replacement (or the whole input when it has fewer rows).
    Endless uniform draw with replacement (ROLL): buffers the finite face set input and then emits an unbounded stream of independent uniform draws from it (a die roll).
    Reads a base relation: inline rows, or an external source/database via the connector.
    Selection (σ) — streaming row filter; preserves the input's delivered ordering.
    Gap-and-island / sessionization (SESSIONIZE): within each partition (by partitionKeys) orders rows ascending by orderColumn and appends a 1-based session-id column (sessionColumn), incremented whenever the gap to the prior row exceeds threshold.
    The set-operation flavour.
     
    Random permutation (SHUFFLE): buffers the input and returns every row exactly once in a uniformly random order (Fisher–Yates).
    Similarity join — an inner theta join whose condition bounds a two-argument function's result by a constant, F(left.x, right.y) >= t, executed by indexing one input under the keys the function's Blocking gives and probing it with the other, rather than calling F on every pair.
    Goal-seek (SOLVE): for each row of input, fills the NULL columns participating in equations — one equation by inverting its arithmetic, several linear ones by elimination, anything else by Newton's method.
    Sort (τ) — establishes ordering on its sort keys.
    Marks a sub-plan whose rows are computed once and read by more than one consumer.
    Top-k per group: within each partition (by groupingAttributes) keeps the count rows highest by sortSpecs, after skipping offset, and with withTies every further row tied with the last of them on all the sort keys.
    Optimal-path extraction (TRACE) over the input weighted edge relation, read as directed edges or, when PhysicalNode.Trace.undirected(), as undirected ones.
    Adjacency-to-forest nesting (TREE): folds the adjacency relation input (with node key keyColumn and parent key parentColumn) into a forest of nested documents — one output row per root, each carrying its subtree in the appended childrenColumn array (siblings ordered by orderSpecs, empty = input order).
    Group-wise universal quantification (∀): keeps the grouping-key tuple of each group in which every row of input satisfies predicate (strict NULL semantics — an UNKNOWN row disqualifies its group).
    Unnest (μ) — explodes the array-valued column into one row per element; outer keeps a NULL-bound row when the array is empty/missing.
    Column-to-rows rotation (UNPIVOT): folds the listed columns into rows — each input row fans out to one output row per listed column, with the column name placed in nameColumn (STRING) and the cell value in valueColumn (ANY).
    Lineage reification (WHY): emits every result tuple of its input unchanged plus the reserved provenance:ANY column holding that tuple's lineage polynomial as a nested document.
    Window (ROLLING / WINDOW): adds one computed column (outputColumn) to every input row, partitioned by partitionKeys and ordered within each partition by sortSpecs.
    The estimated row count the planner computed for each node of a physical plan — the numbers behind Planner.buildSide and the merge-versus-hash choice, kept so :explain can show them.
    A physical plan together with the row estimates the planner computed for it.
    Physical algorithm choice for a PhysicalNode.Trace optimal-path operator.