Skip to main content

Module segment

Module segment 

Source
Expand description

Segmenting a native tree, so each per-series prefix runs where its input is read.

A tree that reads across series answers one partition and gathers whatever it reads. Its per-series prefixes do not need that gather, so each is cut out as a FusedSeries node of its own and keeps the partitions it was scanned with: cut_as_segment decides what can be cut, cut_segments rewrites the tree into one segment per cut, and segment_tree builds the nodes, recursing into a cut that wraps a whole-vector consumer.

Everything here reads the bound tree alone. The columns a node publishes are the planner’s answer, so the builders ask for them through OutputTags, FieldNames and RootSchema instead of deriving them a second time.

Structs§

Segment
One segment: its tree rewritten to read only its own inputs, the scans it reads, and the subtrees cut out of it.

Constants§

NATIVE_ORDERING
The ordering this route compiles its trees against: the weakest both scanners provide.

Functions§

build_evaluated_segment 🔒
build_inner_segment 🔒
Builds one segment’s plan from a subtree, binding its scan inputs without cutting again.
canonical_boundary_stages
Lowers a tree whose root is a canonical merge into a producer and a canonical router.
canonical_local_prefix
Whether the merge producer’s entire prefix can run on each scan partition independently.
collect_segment 🔒
Collects a segment’s scans and cut subtrees, without descending into a cut.
collect_segment_inputs 🔒
Collects every scan input in a selected segment without looking for nested cuts.
contains_canonical_merge
contains_global_consumer
cut_as_segment 🔒
Whether node becomes a segment of its own under a parent that must gather.
cut_segments
Splits node into one segment and the subtrees cut out of it.
evaluated_input_window 🔒
Whether node is a window over an evaluated input - the shape a subquery over anything but a bare selection compiles to.
exportable 🔒
Whether a segment can hand node’s values to another segment.
find_input_node 🔒
fused_output_schema
The columns a FusedSeries node produces.
fused_publish_grid 🔒
The grid one FusedSeries publishes on: the grid its root declares it produces, or the statement’s grid when the root declares none.
independent_scan_pair
is_canonical_cut 🔒
Whether a subtree can be cut without inheriting its parent’s global gather.
is_empty_discovered_input
Whether plan is the typed empty input a discovered selector that matched no table gets.
is_global_consumer 🔒
Whole-vector consumers remain global, but can be cut out as evaluated segments so a pointwise parent does not inherit their single-partition placement.
is_raw_series_source 🔒
is_sourced_plan 🔒
Whether plan already answers raw series frames of its own.
pointwise_operand
Whether node reads samples point-wise, so that one partitioned execution is one answer.
region_local_segment
Whether the dist analyzer places a segment over node region-locally.
rewrite_inner_segment 🔒
Rewrites every input leaf in a selected segment to its index in the segment’s own space.
rewrite_segment 🔒
Rewrites a segment’s tree so every leaf names its index in the segment’s own space.
scan_operand 🔒
segment_tree
Plans tree as several segments, or None when it is one node already.
with_row_name_column
Appends the per-row name column to a rows layout’s tag list.

Type Aliases§

FieldNames
Derives the value column names a statement’s expression gives the compiled fields.
OutputTags
Derives the output tag columns a node publishes, from the tag columns each source declares.
RootSchema
The row schema a statement root publishes for promql, or None when its columns cannot be named once.