Skip to content

Commit

Permalink
update comment for the example rcte in BindingCteState and bind_with
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhseh committed May 14, 2024
1 parent ce16c83 commit 9406b81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/frontend/src/binder/bind_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ pub struct LateralBindContext {
/// WITH RECURSIVE t(n) AS (
/// # -------------^ => Init
/// VALUES (1)
/// # ----------^ => BaseResolved (after binding the base term)
/// UNION ALL
/// SELECT n+1 FROM t WHERE n < 100
/// # ------------------^ => Bound (we know exactly what the entire cte looks like)
/// SELECT n + 1 FROM t WHERE n < 100
/// # --------------------^ => BaseResolved (after binding the base term, this relation will be bound to `Relation::BackCteRef`)
/// )
/// SELECT sum(n) FROM t;
/// # -----------------^ => Bound (we know exactly what the entire `RecursiveUnion` looks like, and this relation will be bound to `Relation::Share`)
/// ```
#[derive(Default, Debug, Clone)]
pub enum BindingCteState {
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/binder/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ impl Binder {

fn bind_with(&mut self, with: With) -> Result<()> {
for cte_table in with.cte_tables {
// note that the new share id is generated here
let share_id = self.next_share_id();
let Cte { alias, query, .. } = cte_table;
let table_name = alias.name.real_value();
Expand Down
10 changes: 4 additions & 6 deletions src/frontend/src/optimizer/plan_node/logical_recursive_union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ use super::expr_visitable::ExprVisitable;
use super::generic::GenericPlanRef;
use super::utils::{childless_record, Distill};
use super::{
generic, ColPrunable, ColumnPruningContext, ExprRewritable, Logical, PlanBase, PlanTreeNode,
PredicatePushdown, PredicatePushdownContext, RewriteStreamContext, ToBatch, ToStream,
ToStreamContext,
gen_filter_and_pushdown, generic, ColPrunable, ColumnPruningContext, ExprRewritable, Logical, PlanBase, PlanTreeNode, PredicatePushdown, PredicatePushdownContext, RewriteStreamContext, ToBatch, ToStream, ToStreamContext
};
use crate::binder::ShareId;
use crate::error::Result;
Expand Down Expand Up @@ -97,10 +95,10 @@ impl ExprVisitable for LogicalRecursiveUnion {}
impl PredicatePushdown for LogicalRecursiveUnion {
fn predicate_pushdown(
&self,
_predicate: Condition,
_ctx: &mut PredicatePushdownContext,
predicate: Condition,
ctx: &mut PredicatePushdownContext,
) -> PlanRef {
unimplemented!("recursive CTE not supported for predicate_pushdown of LogicalRecursiveUnion")
gen_filter_and_pushdown(node, filter_predicate, pushed_predicate, ctx)
}
}

Expand Down

0 comments on commit 9406b81

Please sign in to comment.