(
&self,
expr: RawBinaryExpr,
_schema: &DFSchema,
)
| 35 | |
| 36 | impl ExprPlanner for MyCustomPlanner { |
| 37 | fn plan_binary_op( |
| 38 | &self, |
| 39 | expr: RawBinaryExpr, |
| 40 | _schema: &DFSchema, |
| 41 | ) -> Result<PlannerResult<RawBinaryExpr>> { |
| 42 | match &expr.op { |
| 43 | BinaryOperator::Arrow => { |
| 44 | Ok(PlannerResult::Planned(Expr::BinaryExpr(BinaryExpr { |
| 45 | left: Box::new(expr.left.clone()), |
| 46 | right: Box::new(expr.right.clone()), |
| 47 | op: Operator::StringConcat, |
| 48 | }))) |
| 49 | } |
| 50 | BinaryOperator::LongArrow => { |
| 51 | Ok(PlannerResult::Planned(Expr::BinaryExpr(BinaryExpr { |
| 52 | left: Box::new(expr.left.clone()), |
| 53 | right: Box::new(expr.right.clone()), |
| 54 | op: Operator::Plus, |
| 55 | }))) |
| 56 | } |
| 57 | BinaryOperator::Question => { |
| 58 | Ok(PlannerResult::Planned(Expr::Alias(Alias::new( |
| 59 | Expr::Literal(ScalarValue::Boolean(Some(true)), None), |
| 60 | None::<&str>, |
| 61 | format!("{} ? {}", expr.left, expr.right), |
| 62 | )))) |
| 63 | } |
| 64 | _ => Ok(PlannerResult::Original(expr)), |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | async fn plan_and_collect(sql: &str) -> Result<Vec<RecordBatch>> { |
nothing calls this directly
no test coverage detected