Trait ToStream

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

    // Provided methods
    fn to_stream_with_dist_required(
        &self,
        required_dist: &RequiredDist,
        ctx: &mut ToStreamContext,
    ) -> Result<StreamPlanRef> { ... }
    fn try_better_locality(&self, _columns: &[usize]) -> Option<LogicalPlanRef> { ... }
}
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<(LogicalPlanRef, ColIndexMapping)>

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<StreamPlanRef>

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<StreamPlanRef>

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

Source

fn try_better_locality(&self, _columns: &[usize]) -> Option<LogicalPlanRef>

Implementors§

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 LogicalGetChannelDeltaStats

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 LogicalVectorSearch