Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jdye64 committed Apr 29, 2022
1 parent 83fda12 commit 8beb813
Showing 1 changed file with 0 additions and 55 deletions.
55 changes: 0 additions & 55 deletions dask_planner/src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,62 +61,7 @@ impl PyExpr {
}
}

// #[pyo3(name = "getColumnName")]
// fn column_name(&mut self, expr: PyExpr) -> PyResult<String> {
// let mut val: String = String::from("OK");
// match expr.expr {
// Expr::Alias(expr, name) => match expr.as_ref() {
// Expr::Column(col) => {
// let index = self.projection.input.schema().index_of_column(col).unwrap();
// match self.projection.input.as_ref() {
// LogicalPlan::Aggregate(agg) => {
// let mut exprs = agg.group_expr.clone();
// exprs.extend_from_slice(&agg.aggr_expr);
// match &exprs[index] {
// Expr::AggregateFunction { args, .. } => match &args[0] {
// Expr::Column(col) => {
// println!("AGGREGATE COLUMN IS {}", col.name);
// val = col.name.clone();
// }
// _ => unimplemented!("projection.rs column_name is unimplemented for Expr variant: {:?}", &args[0]),
// },
// _ => unimplemented!("projection.rs column_name is unimplemented for Expr variant: {:?}", &exprs[index]),
// }
// }
// LogicalPlan::TableScan(table_scan) => val = table_scan.table_name.clone(),
// _ => unimplemented!("projection.rs column_name is unimplemented for LogicalPlan variant: {:?}", self.projection.input),
// }
// }
// Expr::Cast { expr, data_type: _ } => {
// let ex_type: Expr = *expr.clone();
// let py_type: PyExpr =
// PyExpr::from(ex_type, Some(self.projection.input.clone()));
// val = self.column_name(py_type).unwrap();
// println!("Setting col name to: {:?}", val);
// }
// _ => val = name.clone().to_ascii_uppercase(),
// },
// Expr::Column(col) => val = col.name.clone(),
// Expr::Cast { expr, data_type: _ } => {
// let ex_type: Expr = *expr;
// let py_type: PyExpr = PyExpr::from(ex_type, Some(self.projection.input.clone()));
// val = self.column_name(py_type).unwrap()
// },
// Expr::Case { expr, when_then_expr, else_expr } => {

// },
// _ => {
// panic!(
// "column_name is unimplemented for Expr variant: {:?}",
// expr.expr
// );
// }
// }
// Ok(val)
// }

fn _column_name(&self, plan: LogicalPlan) -> String {
println!("Getting _column_name for expr: {:?}", &self.expr);
match &self.expr {
Expr::Alias(expr, name) => {
// Only certain LogicalPlan variants are valid in this nested Alias scenario so we
Expand Down

0 comments on commit 8beb813

Please sign in to comment.