AdamGS commented on code in PR #20111:
URL: https://github.com/apache/datafusion/pull/20111#discussion_r2755409711
##########
datafusion/physical-expr/src/simplifier/const_evaluator.rs:
##########
@@ -40,17 +42,17 @@ use crate::expressions::{Column, Literal};
/// - `(1 + 2) * 3` -> `9` (with bottom-up traversal)
/// - `'hello' || ' world'` -> `'hello world'`
pub fn simplify_const_expr(
- expr: &Arc<dyn PhysicalExpr>,
+ expr: Arc<dyn PhysicalExpr>,
) -> Result<Transformed<Arc<dyn PhysicalExpr>>> {
- if !can_evaluate_as_constant(expr) {
- return Ok(Transformed::no(Arc::clone(expr)));
+ if !can_evaluate_as_constant(&expr) {
+ return Ok(Transformed::no(expr));
}
// Create a 1-row dummy batch for evaluation
- let batch = create_dummy_batch()?;
+ let batch = BATCH.get_or_init(create_dummy_batch);
Review Comment:
this is really ugly, I'm removing it locally, will push soon.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]