Dandandan commented on a change in pull request #500:
URL: https://github.com/apache/arrow-datafusion/pull/500#discussion_r645126489
##########
File path: datafusion/src/physical_optimizer/pruning.rs
##########
@@ -391,28 +502,50 @@ fn rewrite_column_expr(
fn build_predicate_expression(
expr: &Expr,
schema: &Schema,
- stat_column_req: &mut Vec<(String, StatisticsType, Field)>,
+ required_columns: &mut RequiredStatColumns,
) -> Result<Expr> {
use crate::logical_plan;
+
+ // Returned for unsupported expressions. Such expressions are
+ // converted to TRUE. This can still be useful when multiple
+ // conditions are joined using AND such as: column > 10 AND TRUE
+ let unhandled = logical_plan::lit(true);
+
// predicate expression can only be a binary expression
let (left, op, right) = match expr {
Expr::BinaryExpr { left, op, right } => (left, *op, right),
+ Expr::Column(name) => {
+ if let Some(expr) =
+ build_single_column_expr(&name, schema, required_columns,
false)
Review comment:
This kind of pattern probably can be written a bit shorter with some
combinators. Something like:
`build_single_column_expr(&name, schema,
required_columns).ok().or(Ok(unhandled))`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]