adriangb commented on code in PR #19128:
URL: https://github.com/apache/datafusion/pull/19128#discussion_r2598893030
##########
datafusion/physical-expr-adapter/src/schema_rewriter.rs:
##########
@@ -34,6 +35,35 @@ use datafusion_physical_expr::{
};
use datafusion_physical_expr_common::physical_expr::PhysicalExpr;
+/// Replace column references in the given physical expression with literal
values.
+///
+/// This is used to substitute partition column references with their literal
values during expression rewriting.
+/// In the future this may be used to replace columns that can be proven to be
constant from statistical analysis
+/// with their literal values as well.
+///
+/// # Arguments
+/// - `expr`: The physical expression in which to replace column references.
+/// - `replacements`: A mapping from column names to their corresponding
literal `ScalarValue`s.
+///
+/// # Returns
+/// - `Result<Arc<dyn PhysicalExpr>>`: The rewritten physical expression with
columns replaced by literals.
+pub fn replace_columns_with_literals(
+ expr: Arc<dyn PhysicalExpr>,
+ replacements: &HashMap<&str, &ScalarValue>,
Review Comment:
Open to accepting `HashMap<String, ScalarValue>` or something if that makes
lifetimes easier
--
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]