Skip to main content

Module partition

Module partition 

Source
Expand description

We have Plans which tell us how data is stored and how to read it. An Expression is a subset of a Plan which tells us how to read the data but doesn’t know how the data is stored.

Given a plan graph and an expression graph, we want to know which expressions can be pushed down to plan’s children. For this we need to know which expressions operate on plan’s disjoint slots (children).

So, for an expression the rule (property) is “Given a plan and an expression graph, if you see this expression, it needs the following slots from a plan”. Let’s look at an example.

If we have a non-nullable PackPlan(a: .., b: .., c: ..) and an Expression $.a > 5 && $.b < 1, we know that $.a > 5 and $.b < 1 are disjoint over the plan, and we never read “c”. We know this because $.a and $.b (get_item) have a rule for a PackPlan which returns us one field.

Thus we partition the expression into two parts: $.a > 5 references child plan for “a” of PackPlan, and we rewrite the expression over this plan to $

5, same for $.b < 1.

$.a > 5 over pack(a: child_plan) => $ > 5 over child_plan

We also need a way to combine these parts back into an Expression. If we call these partitions 0 and 1, the combiner Expression is $.0 && $.1.

$.a > 5 && $.b < 1 over pack(a: …, b: …, c: …) => {0: $ > 5, 1: $ < 1} and a combiner $.0 && $.1

An invariant that must hold in rules is “combiner expression references exactly the slots it has requested to read from the plan”.

See register_pack_partition_rules and register_row_idx_partition_rules for examples.

Structs§

Partition
An expression over one plan slot.
PartitionSession
Session state for partitioning expression over plans
Partitions
Independent expressions and the expression combining their results.
Slots
Slot references recorded while a partition rule builds its expression.

Enums§

PartitionedExpression
The expression partitions and their recombination, or an unpartitioned expression.

Traits§

PartitionRule
A rule describing which plan slots an expression reads.
PartitionedPlan
A PartitionedPlan is a plan which has some logical meaning for its slots and allows partitioning an Expression over itself.

Type Aliases§

PlanSlot
Plan’s child slot index