alamb commented on code in PR #20234:
URL: https://github.com/apache/datafusion/pull/20234#discussion_r2849311070
##########
datafusion/physical-expr/src/simplifier/const_evaluator.rs:
##########
@@ -77,6 +139,20 @@ pub(crate) fn simplify_const_expr_with_dummy(
}
}
+/// Create a 1-row dummy RecordBatch for evaluating constant expressions.
+///
+/// The batch is never actually accessed for data - it's just needed because
+/// the PhysicalExpr::evaluate API requires a RecordBatch. For expressions
+/// that only contain literals, the batch content is irrelevant.
+///
+/// This is the same approach used in the logical expression `ConstEvaluator`.
+pub(crate) fn create_dummy_batch() -> Result<RecordBatch> {
Review Comment:
While reviewing this I was wondering why we need a dummy batch at all -- I
created a follow on PR to create it once and reuse it (should make expression
simplification faster)
- https://github.com/apache/datafusion/pull/20534
--
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]