Skip to content

Commit

Permalink
add bind_all_columns.
Browse files Browse the repository at this point in the history
  • Loading branch information
likg227 committed Mar 3, 2022
1 parent c15800f commit 6566f98
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
13 changes: 13 additions & 0 deletions rust/frontend/src/binder/expr/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,17 @@ impl Binder {
}
}
}

pub fn bind_all_columns(&mut self) -> Result<Vec<ExprImpl>> {
let mut bound_columns = vec![];
self.context.columns.values().for_each(|columns| {
columns.iter().for_each(|column| {
bound_columns.push(ExprImpl::InputRef(Box::new(InputRef::new(
column.index,
column.data_type.clone(),
))));
});
});
Ok(bound_columns)
}
}
4 changes: 3 additions & 1 deletion rust/frontend/src/binder/projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ impl Binder {
}
SelectItem::ExprWithAlias { .. } => todo!(),
SelectItem::QualifiedWildcard(_) => todo!(),
SelectItem::Wildcard => todo!(),
SelectItem::Wildcard => {
select_list.extend(self.bind_all_columns()?.into_iter());
}
}
}
Ok(select_list)
Expand Down
8 changes: 2 additions & 6 deletions rust/frontend/src/planner/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use risingwave_common::error::Result;

use crate::binder::BoundSelect;
use crate::expr::ExprImpl;
use crate::optimizer::plan_node::{PlanRef, LogicalProject};
use crate::optimizer::plan_node::{LogicalProject, PlanRef};
use crate::planner::Planner;

impl Planner {
Expand All @@ -25,11 +25,7 @@ impl Planner {
todo!()
}

fn plan_projection(
&mut self,
input: PlanRef,
projection: Vec<ExprImpl>,
) -> Result<PlanRef> {
fn plan_projection(&mut self, input: PlanRef, projection: Vec<ExprImpl>) -> Result<PlanRef> {
// TODO: support alias.
let expr_alias = vec![None; projection.len()];
Ok(LogicalProject::create(input, projection, expr_alias))
Expand Down

0 comments on commit 6566f98

Please sign in to comment.