risingwave_frontend::optimizer::plan_node

Trait ToStream

source
pub trait ToStream {
    // Required methods
    fn logical_rewrite_for_stream(
        &self,
        ctx: &mut RewriteStreamContext,
    ) -> Result<(PlanRef, ColIndexMapping), RwError>;
    fn to_stream(&self, ctx: &mut ToStreamContext) -> Result<PlanRef, RwError>;

    // Provided method
    fn to_stream_with_dist_required(
        &self,
        required_dist: &RequiredDist,
        ctx: &mut ToStreamContext,
    ) -> Result<PlanRef, RwError> { ... }
}
Expand description

ToStream converts a logical plan node to streaming physical node with an optional required distribution.

when implement this trait you can choose the two ways

  • Implement to_stream and use the default implementation of to_stream_with_dist_required
  • Or, if the required distribution is given, there will be a better plan. For example a hash join with hash-key(a,b) and the plan is required hash-distributed by (a,b,c). you can implement to_stream_with_dist_required, and implement to_stream with to_stream_with_dist_required(RequiredDist::Any). you can see LogicalProject as an example.

Required Methods§

source

fn logical_rewrite_for_stream( &self, ctx: &mut RewriteStreamContext, ) -> Result<(PlanRef, ColIndexMapping), RwError>

logical_rewrite_for_stream will rewrite the logical node, and return (new_plan_node, col_mapping), the col_mapping is for original columns have been changed into some other position.

Now it is used to:

  1. ensure every plan node’s output having pk column
  2. add row_count() in every Agg
source

fn to_stream(&self, ctx: &mut ToStreamContext) -> Result<PlanRef, RwError>

to_stream is equivalent to to_stream_with_dist_required(RequiredDist::Any)

Provided Methods§

source

fn to_stream_with_dist_required( &self, required_dist: &RequiredDist, ctx: &mut ToStreamContext, ) -> Result<PlanRef, RwError>

convert the plan to streaming physical plan and satisfy the required distribution

Implementors§

source§

impl ToStream for BatchDelete

source§

impl ToStream for BatchExchange

source§

impl ToStream for BatchExpand

source§

impl ToStream for BatchFileScan

source§

impl ToStream for BatchFilter

source§

impl ToStream for BatchGroupTopN

source§

impl ToStream for BatchHashAgg

source§

impl ToStream for BatchHashJoin

source§

impl ToStream for BatchHopWindow

source§

impl ToStream for BatchIcebergScan

source§

impl ToStream for BatchInsert

source§

impl ToStream for BatchKafkaScan

source§

impl ToStream for BatchLimit

source§

impl ToStream for BatchLogSeqScan

source§

impl ToStream for BatchLookupJoin

source§

impl ToStream for BatchMaxOneRow

source§

impl ToStream for BatchMySqlQuery

source§

impl ToStream for BatchNestedLoopJoin

source§

impl ToStream for BatchOverWindow

source§

impl ToStream for BatchPostgresQuery

source§

impl ToStream for BatchProject

source§

impl ToStream for BatchProjectSet

source§

impl ToStream for BatchSeqScan

source§

impl ToStream for BatchSimpleAgg

source§

impl ToStream for BatchSort

source§

impl ToStream for BatchSortAgg

source§

impl ToStream for BatchSource

source§

impl ToStream for BatchSysSeqScan

source§

impl ToStream for BatchTableFunction

source§

impl ToStream for BatchTopN

source§

impl ToStream for BatchUnion

source§

impl ToStream for BatchUpdate

source§

impl ToStream for BatchValues

source§

impl ToStream for LogicalAgg

source§

impl ToStream for LogicalApply

source§

impl ToStream for LogicalCdcScan

source§

impl ToStream for LogicalChangeLog

source§

impl ToStream for LogicalCteRef

source§

impl ToStream for LogicalDedup

source§

impl ToStream for LogicalDelete

source§

impl ToStream for LogicalExcept

source§

impl ToStream for LogicalExpand

source§

impl ToStream for LogicalFileScan

source§

impl ToStream for LogicalFilter

source§

impl ToStream for LogicalHopWindow

source§

impl ToStream for LogicalIcebergScan

source§

impl ToStream for LogicalInsert

source§

impl ToStream for LogicalIntersect

source§

impl ToStream for LogicalJoin

source§

impl ToStream for LogicalKafkaScan

source§

impl ToStream for LogicalLimit

source§

impl ToStream for LogicalMaxOneRow

source§

impl ToStream for LogicalMultiJoin

source§

impl ToStream for LogicalMySqlQuery

source§

impl ToStream for LogicalNow

source§

impl ToStream for LogicalOverWindow

source§

impl ToStream for LogicalPostgresQuery

source§

impl ToStream for LogicalProject

source§

impl ToStream for LogicalProjectSet

source§

impl ToStream for LogicalRecursiveUnion

source§

impl ToStream for LogicalScan

source§

impl ToStream for LogicalShare

source§

impl ToStream for LogicalSource

source§

impl ToStream for LogicalSysScan

source§

impl ToStream for LogicalTableFunction

source§

impl ToStream for LogicalTopN

source§

impl ToStream for LogicalUnion

source§

impl ToStream for LogicalUpdate

source§

impl ToStream for LogicalValues

source§

impl ToStream for StreamAsOfJoin

source§

impl ToStream for StreamCdcTableScan

source§

impl ToStream for StreamChangeLog

source§

impl ToStream for StreamDedup

source§

impl ToStream for StreamDeltaJoin

source§

impl ToStream for StreamDml

source§

impl ToStream for StreamDynamicFilter

source§

impl ToStream for StreamEowcOverWindow

source§

impl ToStream for StreamExchange

source§

impl ToStream for StreamExpand

source§

impl ToStream for StreamFilter

source§

impl ToStream for StreamFsFetch

source§

impl ToStream for StreamGlobalApproxPercentile

source§

impl ToStream for StreamGroupTopN

source§

impl ToStream for StreamHashAgg

source§

impl ToStream for StreamHashJoin

source§

impl ToStream for StreamHopWindow

source§

impl ToStream for StreamLocalApproxPercentile

source§

impl ToStream for StreamMaterialize

source§

impl ToStream for StreamNow

source§

impl ToStream for StreamOverWindow

source§

impl ToStream for StreamProject

source§

impl ToStream for StreamProjectSet

source§

impl ToStream for StreamRowIdGen

source§

impl ToStream for StreamRowMerge

source§

impl ToStream for StreamShare

source§

impl ToStream for StreamSimpleAgg

source§

impl ToStream for StreamSink

source§

impl ToStream for StreamEowcSort

source§

impl ToStream for StreamSource

source§

impl ToStream for StreamSourceScan

source§

impl ToStream for StreamStatelessSimpleAgg

source§

impl ToStream for StreamTableScan

source§

impl ToStream for StreamTemporalJoin

source§

impl ToStream for StreamTopN

source§

impl ToStream for StreamUnion

source§

impl ToStream for StreamValues

source§

impl ToStream for StreamWatermarkFilter