notfilippo commented on code in PR #11978: URL: https://github.com/apache/datafusion/pull/11978#discussion_r1717282407
########## datafusion/physical-plan/src/projection.rs: ########## @@ -306,9 +306,10 @@ impl ProjectionStream { let arrays = self .expr .iter() - .map(|expr| { + .zip(&self.schema.fields) + .map(|(expr, field)| { expr.evaluate(batch) - .and_then(|v| v.into_array(batch.num_rows())) + .and_then(|v| v.into_array_of_type(batch.num_rows(), field.data_type())) Review Comment: Not sure if casting here is a correct approach. ########## datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs: ########## @@ -627,15 +629,34 @@ impl<'a> ConstEvaluator<'a> { return ConstSimplifyResult::NotSimplified(s); } + let start_type = match expr.get_type(&self.input_schema) { + Ok(t) => t, + Err(err) => return ConstSimplifyResult::SimplifyRuntimeError(err, expr), + }; + let phys_expr = match create_physical_expr(&expr, &self.input_schema, self.execution_props) { Ok(e) => e, Err(err) => return ConstSimplifyResult::SimplifyRuntimeError(err, expr), }; + let col_val = match phys_expr.evaluate(&self.input_batch) { Ok(v) => v, Err(err) => return ConstSimplifyResult::SimplifyRuntimeError(err, expr), }; + + // TODO(@notfilippo): a fix for the select_arrow_cast error Review Comment: This check partially fixes the issue with `select_arrow_cast`. -- 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. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org