Expand description
Defines all kinds of node in the plan tree, each node represent a relational expression.
We use a immutable style tree structure, every Node are immutable and cannot be modified after
it has been created. If you want to modify the node, such as rewriting the expression in a
ProjectNode or changing a node’s input node, you need to create a new node. We use Rc as the
node’s reference, and a node just storage its inputs’ reference, so change a node just need
create one new node but not the entire sub-tree.
So when you want to add a new node, make sure:
- each field in the node struct are private
- recommend to implement the construction of Node in a unified
new()function, if have multi methods to construct, make they have a consistent behavior - all field should be valued in construction, so the properties’ derivation should be finished
in the
new()function.
Re-exports§
pub use generic::PlanAggCall;pub use generic::PlanAggCallDisplay;
Modules§
- batch
- batch_
delete 🔒 - batch_
exchange 🔒 - batch_
expand 🔒 - batch_
file_ 🔒scan - batch_
filter 🔒 - batch_
get_ 🔒channel_ delta_ stats - batch_
group_ 🔒topn - batch_
hash_ 🔒agg - batch_
hash_ 🔒join - batch_
hop_ 🔒window - batch_
iceberg_ 🔒scan - batch_
insert 🔒 - batch_
kafka_ 🔒scan - batch_
limit 🔒 - batch_
log_ 🔒seq_ scan - batch_
lookup_ 🔒join - batch_
max_ 🔒one_ row - batch_
mysql_ 🔒query - batch_
nested_ 🔒loop_ join - batch_
over_ 🔒window - batch_
postgres_ 🔒query - batch_
project 🔒 - batch_
project_ 🔒set - batch_
seq_ 🔒scan - batch_
simple_ 🔒agg - batch_
sort 🔒 - batch_
sort_ 🔒agg - batch_
source 🔒 - batch_
sys_ 🔒seq_ scan - batch_
table_ 🔒function - batch_
topn 🔒 - batch_
union 🔒 - batch_
update 🔒 - batch_
values 🔒 - batch_
vector_ 🔒search - col_
pruning 🔒 - convert 🔒
- derive 🔒
- eq_
join_ 🔒predicate - expr_
rewritable 🔒 - expr_
visitable 🔒 - generic
- This module contains the generic plan nodes that are shared by all the plan nodes. They are meant to reuse the common fields between logical, batch and stream nodes.
- logical_
agg 🔒 - logical_
apply 🔒 - logical_
cdc_ 🔒scan - logical_
changelog 🔒 - logical_
cte_ 🔒ref - logical_
dedup 🔒 - logical_
delete 🔒 - logical_
except 🔒 - logical_
expand 🔒 - logical_
file_ 🔒scan - logical_
filter 🔒 - logical_
gap_ 🔒fill - logical_
get_ 🔒channel_ delta_ stats - logical_
hop_ 🔒window - logical_
iceberg_ 🔒scan - logical_
insert 🔒 - logical_
intersect 🔒 - logical_
join 🔒 - logical_
kafka_ 🔒scan - logical_
limit 🔒 - logical_
locality_ 🔒provider - logical_
max_ 🔒one_ row - logical_
multi_ 🔒join - logical_
mysql_ 🔒query - logical_
now 🔒 - logical_
over_ 🔒window - logical_
postgres_ 🔒query - logical_
project 🔒 - logical_
project_ 🔒set - logical_
recursive_ 🔒union - logical_
scan 🔒 - logical_
share 🔒 - logical_
source 🔒 - logical_
sys_ 🔒scan - logical_
table_ 🔒function - logical_
topn 🔒 - logical_
union 🔒 - logical_
update 🔒 - logical_
values 🔒 - logical_
vector_ 🔒search - merge_
eq_ 🔒nodes - plan_
base 🔒 - plan_
node_ 🔒meta - plan_
tree_ 🔒node - predicate_
pushdown 🔒 - stream
- stream_
asof_ 🔒join - stream_
cdc_ 🔒table_ scan - stream_
changelog 🔒 - stream_
dedup 🔒 - stream_
delta_ 🔒join - stream_
dml 🔒 - stream_
dynamic_ 🔒filter - stream_
eowc_ 🔒gap_ fill - stream_
eowc_ 🔒over_ window - stream_
exchange 🔒 - stream_
expand 🔒 - stream_
filter 🔒 - stream_
fs_ 🔒fetch - stream_
gap_ 🔒fill - stream_
global_ 🔒approx_ percentile - stream_
group_ 🔒topn - stream_
hash_ 🔒agg - stream_
hash_ 🔒join - stream_
hop_ 🔒window - stream_
join_ 🔒common - stream_
local_ 🔒approx_ percentile - stream_
locality_ 🔒provider - stream_
materialize 🔒 - stream_
materialized_ 🔒exprs - stream_
now 🔒 - stream_
over_ 🔒window - stream_
project 🔒 - stream_
project_ 🔒set - stream_
row_ 🔒id_ gen - stream_
row_ 🔒merge - stream_
share 🔒 - stream_
simple_ 🔒agg - stream_
sink 🔒 - stream_
sort 🔒 - stream_
source 🔒 - stream_
source_ 🔒scan - stream_
stateless_ 🔒simple_ agg - stream_
sync_ 🔒log_ store - stream_
table_ 🔒scan - stream_
temporal_ 🔒join - stream_
topn 🔒 - stream_
union 🔒 - stream_
upstream_ 🔒sink_ union - stream_
values 🔒 - stream_
vector_ 🔒index_ write - stream_
watermark_ 🔒filter - to_
prost 🔒 - utils
Macros§
- impl_
down_ 🔒cast_ fn - impl plan node downcast fn for each node.
- impl_
generic_ 🔒plan_ ref_ method - impl_
plan_ 🔒node - impl_
plan_ 🔒node_ meta - impl
PlanNodeTypefn for each node. - impl_
trait 🔒
Structs§
- Batch
- The marker for batch convention.
- Batch
Delete BatchDeleteimplementssuper::LogicalDelete- Batch
Exchange BatchExchangeimposes a particular distribution on its input without changing its content.- Batch
Expand - Batch
Extra - Extra fields for batch plan nodes.
- Batch
File Scan - Batch
Filter BatchFilterimplementssuper::LogicalFilter- Batch
GetChannel Delta Stats BatchGetChannelDeltaStatsrepresents a batch plan node that retrieves channel statistics from the dashboard API. It has no inputs and returns channel stats data.- Batch
Group TopN BatchGroupTopNimplementssuper::LogicalTopNto find the top N elements with a heap- Batch
Hash Agg - Batch
Hash Join BatchHashJoinimplementssuper::LogicalJoinwith hash table. It builds a hash table from inner (right-side) relation and then probes with data from outer (left-side) relation to get output rows.- Batch
HopWindow BatchHopWindowimplementssuper::LogicalHopWindowto evaluate specified expressions on input rows- Batch
Iceberg Scan - Batch
Insert BatchInsertimplementssuper::LogicalInsert- Batch
Kafka Scan - Batch
Limit BatchLimitimplementssuper::LogicalLimitto fetch specified rows from input- Batch
LogSeq Scan - Batch
Lookup Join - Batch
MaxOne Row BatchMaxOneRowfetches up to one row from the input, returning an error if the input contains more than one row at runtime.- Batch
MySql Query - Batch
Nested Loop Join BatchNestedLoopJoinimplementssuper::LogicalJoinby checking the join condition against all pairs of rows from inner & outer side within 2 layers of loops.- Batch
Over Window - Batch
Postgres Query - Batch
Project BatchProjectimplementssuper::LogicalProjectto evaluate specified expressions on input rows- Batch
Project Set - Batch
SeqScan BatchSeqScanimplementssuper::LogicalScanto scan from a row-oriented table- Batch
Simple Agg - Batch
Sort BatchSortbuffers all data from input and sort these rows by specified order, providing the collation required by user or parent plan node.- Batch
Sort Agg - Batch
Source BatchSourcerepresents a table/connector source at the very beginning of the graph.- Batch
SysSeq Scan BatchSysSeqScanimplementssuper::LogicalSysScanto scan from a row-oriented table- Batch
Table Function - Batch
TopN BatchTopNimplementssuper::LogicalTopNto find the top N elements with a heap- Batch
Union BatchUnionimplementssuper::LogicalUnion- Batch
Update BatchUpdateimplementssuper::LogicalUpdate- Batch
Values - Batch
Vector Search - Column
Pruning Context - EqJoin
Predicate - The join predicate used in optimizer
- EqJoin
Predicate Display - Iceberg
Partition Info - Logical
- The marker for logical convention.
- Logical
Agg LogicalAgggroups input data by their group key and computes aggregation functions.- Logical
Apply LogicalApplyrepresents a correlated join, where the right side may refer to columns from the left side.- Logical
CdcScan LogicalCdcScanreads rows of a table from an external upstream database- Logical
Change Log - Logical
CteRef - Logical
Dedup LogicalDedupdeduplicates data on specific columns. It is now used inDISTINCT ONwithout anORDER BY.- Logical
Delete LogicalDeleteiterates on input relation and delete the data from specified table.- Logical
Except LogicalExceptreturns the rows of its first input except any matching rows from its other inputs.- Logical
Expand LogicalExpandexpands one row multiple times according tocolumn_subsetsand also keeps original columns of input. It can be used to implement distinct aggregation and group set.- Logical
File Scan - Logical
Filter LogicalFilteriterates over its input and returns elements for whichpredicateevaluates to true, filtering out the others.- Logical
GapFill LogicalGapFillimplementssuper::Logicalto represent a gap-filling operation on a time series.- Logical
GetChannel Delta Stats LogicalGetChannelDeltaStatsrepresents a plan node that retrieves channel statistics from the dashboard API. It has no inputs and returns channel stats data.- Logical
HopWindow LogicalHopWindowimplements Hop Table Function.- Logical
Iceberg Scan LogicalIcebergScanis only used by batch queries. At the beginning of the batch query optimization,LogicalSourcewith a iceberg property would be converted into aLogicalIcebergScan.- Logical
Insert LogicalInsertiterates on input relation and insert the data into specified table.- Logical
Intersect LogicalIntersectreturns the intersect of the rows of its inputs. Ifallis false, it needs to eliminate duplicates.- Logical
Join LogicalJoincombines two relations according to some condition.- Logical
Kafka Scan LogicalKafkaScanis only used by batch queries. At the beginning of the batch query optimization,LogicalSourcewith a kafka property would be converted into aLogicalKafkaScan.- Logical
Limit LogicalLimitfetches up tolimitrows fromoffset- Logical
Locality Provider LogicalLocalityProviderprovides locality for operators during backfilling. It buffers input data into a state table using locality columns as primary key prefix.- Logical
MaxOne Row LogicalMaxOneRowfetches up to one row from the input, returning an error if the input contains more than one row at runtime. Only available in batch mode.- Logical
Multi Join LogicalMultiJoincombines two or more relations according to some condition.- Logical
Multi Join Builder - Logical
MySql Query - Logical
Now - Logical
Over Window LogicalOverWindowperformsOVERwindow functions to its input.- Logical
Postgres Query - Logical
Project LogicalProjectcomputes a set of expressions from its input relation.- Logical
Project Set LogicalProjectSetprojects one row multiple times according toselect_list.- Logical
Recursive Union LogicalRecursiveUnionreturns the union of the rows of its inputs. note: ifallis false, it needs to eliminate duplicates.- Logical
Scan LogicalScanreturns contents of a table or other equivalent object- Logical
Share LogicalShareoperator is used to represent reusing of existing operators. It is the key operator for DAG plan. It could have multiple parents which makes it different from other operators. Currently, it has been used to the following scenarios:- Logical
Source LogicalSourcereturns contents of a table or other equivalent object- Logical
SysScan LogicalSysScanreturns contents of a table or other equivalent object- Logical
Table Function LogicalTableFunctionis a scalar/table function used as a relation (in theFROMclause).- Logical
TopN LogicalTopNsorts the input data and fetches up tolimitrows fromoffset- Logical
Union LogicalUnionreturns the union of the rows of its inputs. Ifallis false, it needs to eliminate duplicates.- Logical
Update LogicalUpdateiterates on input relation, set some columns, and inject update records into specified table.- Logical
Values LogicalValuesbuilds rows according to a list of expressions- Logical
Vector Search - NoExtra
- No extra fields for logical plan nodes.
- NoShare
Node - Plan
Base - The common fields of all plan nodes with different conventions.
- Plan
Node Id - PlanRef
- Predicate
Pushdown Context - Rewrite
Stream Context - Stream
- The marker for stream convention.
- Stream
AsOf Join StreamAsOfJoinimplementssuper::LogicalJoinwith hash tables.- Stream
CdcTable Scan StreamCdcTableScanis a virtual plan node to represent a stream cdc table scan. It will be converted to cdc backfill + merge node (for upstream source)- Stream
Change Log - Stream
Dedup - Stream
Delta Join StreamDeltaJoinimplementssuper::LogicalJoinwith delta join. It requires its two inputs to be indexes.- Stream
Dml - Stream
Dynamic Filter - Stream
Eowc GapFill StreamEowcGapFillimplementssuper::Streamto represent a gap-filling operation on a time series in streaming mode.- Stream
Eowc Over Window - Stream
Eowc Sort - Stream
Exchange StreamExchangeimposes a particular distribution on its input without changing its content.- Stream
Expand - Stream
Extra - Extra fields for stream plan nodes.
- Stream
Filter StreamFilterimplementssuper::LogicalFilter- Stream
FsFetch - Fetch files from filesystem/s3/iceberg.
- Stream
GapFill StreamGapFillimplementssuper::Streamto represent a gap-filling operation on a time series in normal streaming mode (without EOWC semantics).- Stream
Global Approx Percentile - Stream
Group TopN - Stream
Hash Agg - Stream
Hash Join StreamHashJoinimplementssuper::LogicalJoinwith hash table. It builds a hash table from inner (right-side) relation and probes with data from outer (left-side) relation to get output rows.- Stream
HopWindow StreamHopWindowrepresents a hop window table function.- Stream
Local Approx Percentile - Stream
Locality Provider StreamLocalityProviderimplementssuper::LogicalLocalityProvider- Stream
Materialize - Materializes a stream.
- Stream
Materialized Exprs StreamMaterializedExprsmaterializes the results of a set of expressions. The expressions are evaluated once and the results are stored in a state table, avoiding re-evaluation for delete operations. Particularly useful for expensive or non-deterministic expressions like UDF calls.- Stream
Now - Stream
Over Window - Stream
Project StreamProjectimplementssuper::LogicalProjectto evaluate specified expressions on input rows.- Stream
Project Set - Stream
RowId Gen - Stream
RowMerge StreamRowMergeis used for merging two streams with the same stream key and distribution. It will buffer the outputs from its input streams until we receive a barrier. On receiving a barrier, it willProjecttheir outputs according to the providedlhs_mappingandrhs_mapping.- Stream
Share StreamSharewill be translated into anExchangeNodebased on its distribution finally.- Stream
Simple Agg - Stream
Sink StreamSinkrepresents a table/connector sink at the very end of the graph.- Stream
Source StreamSourcerepresents a table/connector source at the very beginning of the graph.- Stream
Source Scan StreamSourceScanscans from a shared source. It forwards data from the upstreamStreamSource, and also backfills data from the external source.- Stream
Stateless Simple Agg - Streaming stateless simple agg.
- Stream
Sync LogStore - Stream
Table Scan StreamTableScanis a virtual plan node to represent a stream table scan. It will be converted to stream scan + merge node (for upstream materialize) + batch table scan when converting toMViewcreation request.- Stream
Temporal Join - Stream
TopN StreamTopNimplementssuper::LogicalTopNto find the top N elements with a heap- Stream
Union StreamUnionimplementssuper::LogicalUnion- Stream
Upstream Sink Union - Stream
Values StreamValuesimplementsLogicalValues.to_stream()- Stream
Vector Index Write - Stream
Watermark Filter - ToStream
Context
Enums§
- Batch
Plan Node Type - each enum value represent a
PlanNodestruct type, help us to dispatch and downcast - Logical
Plan Node Type - each enum value represent a
PlanNodestruct type, help us to dispatch and downcast - Partition
Compute Info - Why we need
PartitionComputeInfo? - Stream
Plan Node Type - each enum value represent a
PlanNodestruct type, help us to dispatch and downcast
Constants§
- PLAN_
DEPTH_ THRESHOLD - Recursion depth threshold for plan node visitor to send notice to user.
- PLAN_
TOO_ DEEP_ NOTICE - Notice message for plan node visitor to send to user when the depth threshold is reached.
Traits§
- Batch
Plan Node - ColPrunable
- The trait for column pruning, only logical plan node will use it, though all plan node impl it.
- Convention
Marker - A marker trait for different conventions, used for enforcing type safety.
- Endo
Plan - A more sophisticated
Endotaking into account of the DAG structure ofPlanRef. In addition toEndo, one have to specify thecachedfunction to persist transformedLogicalShareand their results, and thedag_applyfunction will take care to only transform everyLogicalSharenodes once. - Explain
- Expr
Rewritable - Rewrites expressions in a
PlanRef. Due toShareoperator, theExprRewriterneeds to be idempotent i.e., applying it more than once to the sameExprImplwill be a noop on subsequent applications.rewrite_exprsshould only return a plan with the given node modified. To rewrite recursively, callrewrite_exprs_recursive. - Logical
Plan Node - Plan
Node Meta - The trait for accessing the meta data and
PlanBasefor plan nodes. - Plan
Tree Node - The plan node trait of different conventions really need about tree structure and used by optimizer framework. every plan node should impl it.
- Plan
Tree Node Binary - See
PlanTreeNode - Plan
Tree Node Leaf - See
PlanTreeNode - Plan
Tree Node Unary - See
PlanTreeNode - Predicate
Pushdown - The trait for predicate pushdown, only logical plan node will use it, though all plan node impl it.
- Semantics
- Share
Node - Stream
Node - Stream
Plan Node - The common trait over all plan nodes. Used by optimizer framework which will treat all node as
dyn PlanNode - ToBatch
ToBatchallows to convert a logical plan node to batch physical node with an optional required order.- ToBatch
Pb - ToDistributed
Batch ToDistributedBatchallows to convert a batch physical plan to distributed batch plan, by insert exchange node, with an optional required order and distributed.- ToLocal
Batch - Converts a batch physical plan to local plan for local execution.
- ToStream
ToStreamconverts a logical plan node to streaming physical node with an optional required distribution.- TryTo
Batch Pb - TryTo
Stream Pb - Visit
Exprs 🔒Recursive - Visit
Plan - A more sophisticated
Visittaking into account of the DAG structure ofPlanRef. In addition toVisit, one have to specifyvisitedto store and report visitedLogicalSharenodes, and thedag_visitfunction will take care to only visit everyLogicalSharenodes once. See alsoEndoPlan.
Functions§
- gen_
filter_ and_ pushdown - pretty_
config 🔒 - reorganize_
elements_ id - In order to let expression display id started from 1 for explaining, hidden column names and other places. We will reset expression display id to 0 and clone the whole plan to reset the schema.
- stream_
enforce_ eowc_ requirement - try_
enforce_ locality_ requirement - Try to enforce the locality requirement on the given columns.
If a better plan can be found, return the better plan.
If no better plan can be found, and locality backfill is enabled, wrap the plan
with
LogicalLocalityProvider. Otherwise, return the plan as is.