Apache DataFusion SQL Query Engine
Refactor `Expr::Between` to use a struct (#3850)
baishen743ff28e4a5f
diff --git a/datafusion-examples/examples/rewrite_expr.rs b/datafusion-examples/examples/rewrite_expr.rsindex 5e93bfd737..d4a34e1993 100644--- a/datafusion-examples/examples/rewrite_expr.rs+++ b/datafusion-examples/examples/rewrite_expr.rs@@ -18,7 +18,9 @@use arrow::datatypes::{DataType, Field, Schema, SchemaRef};use datafusion_common::{DataFusionError, Result};use datafusion_expr::expr_rewriter::{ExprRewritable, ExprRewriter};-use datafusion_expr::{AggregateUDF, Expr, Filter, LogicalPlan, ScalarUDF, TableSource};+use datafusion_expr::{+ AggregateUDF, Between, Expr, Filter, LogicalPlan, ScalarUDF, TableSource,+};use datafusion_optimizer::optimizer::Optimizer;use datafusion_optimizer::{utils, OptimizerConfig, OptimizerRule};use datafusion_sql::planner::{ContextProvider, SqlToRel};@@ -99,12 +101,12 @@ struct MyExprRewriter {}impl ExprRewriter for MyExprRewriter {fn mutate(&mut self, expr: Expr) -> Result<Expr> {match expr {- Expr::Between {- negated,+ Expr::Between(Between {expr,+ negated,low,high,- } => {+ }) => {let expr: Expr = expr.as_ref().clone();let low: Expr = low.as_ref().clone();let high: Expr = high.as_ref().clone();diff --git a/datafusion/core/src/physical_plan/planner.rs b/datafusion/core/src/physical_plan/planner.rsindex 5ccf9f70f3..c3d28a7a82 100644--- a/datafusion/core/src/physical_plan/planner.rs+++ b/datafusion/core/src/physical_plan/planner.rs@@ -59,7 +59,7 @@ use arrow::compute::SortOptions;use arrow::datatypes::{Schema, SchemaRef};use async_trait::async_trait;use datafusion_common::{DFSchema, ScalarValue};-use datafusion_expr::expr::{GroupingSet, Like};+use datafusion_expr::expr::{Between, GroupingSet, Like};use datafusion_expr::expr_rewriter::unnormalize_cols;use datafusion_expr::utils::{expand_wildcard, expr_to_columns};use datafusion_expr::WindowFrameUnits;@@ -258,12 +258,12 @@ fn create_physical_name(e: &Expr, is_first_expr: bool) -> Result<String> {Expr::ScalarSubquery(_) => Err(DataFusionError::NotImplemented("Scalar subqueries are not yet supported in the physical plan".to_string(),)),- Expr::Between {+ Expr::Between(Between {expr,negated,low,high,- } => {+ }) => {let expr = create_physical_name(expr, false)?;let low = create_physical_name(low, false)?;let high = create_physical_name(high, false)?;diff --git a/datafusion/expr/src/expr.rs b/datafusion/expr/src/expr.rsindex 8b89380992..82ccbce499 100644--- a/datafusion/expr/src/expr.rs+++ b/datafusion/expr/src/expr.rs@@ -134,16 +134,7 @@ pub enum Expr {key: ScalarValue,},/// Whether an expression is between a given range.- Between {- /// The value to compare- expr: Box<Expr>,- /// Whether the expression is negated- negated: bool,- /// The low end of the range- low: Box<Expr>,- /// The high end of the range- high: Box<Expr>,- },+ Between(Between),/// The CASE expression is similar to a series of nested if/else and there are two forms that/// can be used. The first form consists of a series of boolean "when" expressions with/// corresponding "then" expressions, and an optional "else" expression.@@ -322,6 +313,31 @@ impl Like {}}+/// BETWEEN expression+#[derive(Clone, PartialEq, Eq, Hash)]+pub struct Between {+ /// The value to compare+ pub expr: Box<Expr>,+ /// Whether the expression is negated+ pub negated: bool,+ /// The low end of the range+ pub low: Box<Expr>,+ /// The high end of the range+ pub high: Box<Expr>,+}++impl Between {+ /// Create a new Between expression+ pub fn new(expr: Box<Expr>, negated: bool, low: Box<Expr>, high: Box<Expr>) -> Self {+ Self {+ expr,+ negated,+ low,+ high,+ }+ }+}+/// Grouping sets/// See https://www.postgresql.org/docs/current/queries-table-expressions.html#QUERIES-GROUPING-SETS/// for Postgres definition.@@ -754,12 +770,12 @@ impl fmt::Debug for Expr {}Ok(())}- Expr::Between {+ Expr::Between(Between {expr,negated,low,high,- } => {+ }) => {if *negated {write!(f, "{:?} NOT BETWEEN {:?} AND {:?}", expr, low, high)} else {@@ -1136,12 +1152,12 @@ fn create_name(e: &Expr) -> Result<String> {Ok(format!("{} IN ({:?})", expr, list))}}- Expr::Between {+ Expr::Between(Between {expr,negated,low,high,- } => {+ }) => {let expr = create_name(expr)?;let low = create_name(low)?;let high = create_name(high)?;diff --git a/datafusion/expr/src/expr_rewriter.rs b/datafusion/expr/src/expr_rewriter.rsindex 97d39ceb7d..9cfb126c03 100644--- a/datafusion/expr/src/expr_rewriter.rs+++ b/datafusion/expr/src/expr_rewriter.rs@@ -17,7 +17,7 @@//! Expression rewriter-use crate::expr::{Case, GroupingSet, Like};+use crate::expr::{Between, Case, GroupingSet, Like};use crate::logical_plan::{Aggregate, Projection};use crate::utils::{from_plan, grouping_set_to_exprlist};use crate::{Expr, ExprSchemable, LogicalPlan};@@ -173,17 +173,17 @@ impl ExprRewritable for Expr {Expr::IsNotUnknown(rewrite_boxed(expr, rewriter)?)}Expr::Negative(expr) => Expr::Negative(rewrite_boxed(expr, rewriter)?),- Expr::Between {+ Expr::Between(Between {expr,+ negated,low,high,+ }) => Expr::Between(Between::new(+ rewrite_boxed(expr, rewriter)?,negated,- } => Expr::Between {- expr: rewrite_boxed(expr, rewriter)?,- low: rewrite_boxed(low, rewriter)?,- high: rewrite_boxed(high, rewriter)?,- negated,- },+ rewrite_boxed(low, rewriter)?,+ rewrite_boxed(high, rewriter)?,+ )),Expr::Case(case) => {let expr = rewrite_option_box(case.expr, rewriter)?;let when_then_expr = casediff --git a/datafusion/expr/src/expr_schema.rs b/datafusion/expr/src/expr_schema.rsindex 103f8edccd..01cb015963 100644--- a/datafusion/expr/src/expr_schema.rs+++ b/datafusion/expr/src/expr_schema.rs@@ -15,7 +15,7 @@// specific language governing permissions and limitations// under the License.-use super::{Expr, Like};+use super::{Between, Expr, Like};use crate::field_util::get_indexed_field;use crate::type_coercion::binary::binary_operator_data_type;use crate::{aggregate_function, function, window_function};@@ -160,8 +160,8 @@ impl ExprSchemable for Expr {| Expr::Not(expr)| Expr::Negative(expr)| Expr::Sort { expr, .. }- | Expr::Between { expr, .. }| Expr::InList { expr, .. } => expr.nullable(input_schema),+ Expr::Between(Between { expr, .. }) => expr.nullable(input_schema),Expr::Column(c) => input_schema.nullable(c),Expr::Literal(value) => Ok(value.is_null()),Expr::Case(case) => {diff --git a/datafusion/expr/src/expr_visitor.rs b/datafusion/expr/src/expr_visitor.rsindex a7d19d255a..57457cee58 100644--- a/datafusion/expr/src/expr_visitor.rs+++ b/datafusion/expr/src/expr_visitor.rs@@ -17,7 +17,7 @@//! Expression visitor-use crate::{expr::GroupingSet, Expr, Like};+use crate::{expr::GroupingSet, Between, Expr, Like};use datafusion_common::Result;/// Controls how the visitor recursion should proceed.@@ -146,9 +146,9 @@ impl ExprVisitable for Expr {let visitor = expr.accept(visitor)?;pattern.accept(visitor)}- Expr::Between {+ Expr::Between(Between {expr, low, high, ..- } => {+ }) => {let visitor = expr.accept(visitor)?;let visitor = low.accept(visitor)?;high.accept(visitor)diff --git a/datafusion/expr/src/lib.rs b/datafusion/expr/src/lib.rsindex 72a9cb747e..c292d86d25 100644--- a/datafusion/expr/src/lib.rs+++ b/datafusion/expr/src/lib.rs@@ -56,7 +56,7 @@ pub use accumulator::{Accumulator, AggregateState};pub use aggregate_function::AggregateFunction;pub use built_in_function::BuiltinScalarFunction;pub use columnar_value::{ColumnarValue, NullColumnarValue};-pub use expr::{Case, Expr, GroupingSet, Like};+pub use expr::{Between, Case, Expr, GroupingSet, Like};pub use expr_fn::*;pub use expr_schema::ExprSchemable;pub use function::{diff --git a/datafusion/optimizer/src/simplify_expressions.rs b/datafusion/optimizer/src/simplify_expressions.rsindex ebb1be089f..0499fea9f5 100644--- a/datafusion/optimizer/src/simplify_expressions.rs+++ b/datafusion/optimizer/src/simplify_expressions.rs@@ -25,6 +25,7 @@ use arrow::error::ArrowError;use arrow::record_batch::RecordBatch;use datafusion_common::{DFSchema, DataFusionError, Result, ScalarValue};use datafusion_expr::{+ expr::Between,expr_fn::{and, or},expr_rewriter::{ExprRewritable, ExprRewriter, RewriteRecursion},lit,@@ -245,17 +246,12 @@ fn negate_clause(expr: Expr) -> Expr {} => expr.in_list(list, !negated),// not (A between B and C) ===> (A not between B and C)// not (A not between B and C) ===> (A between B and C)- Expr::Between {- expr,- negated,- low,- high,- } => Expr::Between {- expr,- negated: !negated,- low,- high,- },+ Expr::Between(between) => Expr::Between(Between::new(+ between.expr,+ !between.negated,+ between.low,+ between.high,+ )),// use not clause_ => Expr::Not(Box::new(expr)),}@@ -949,18 +945,16 @@ impl<'a, S: SimplifyInfo> ExprRewriter for Simplifier<'a, S> {// a between 3 and 5 --> a >= 3 AND a <=5// a not between 3 and 5 --> a < 3 OR a > 5- Between {- expr,- low,- high,- negated,- } => {- if negated {- let l = *expr.clone();- let r = *expr;- or(l.lt(*low), r.gt(*high))+ Between(between) => {+ if between.negated {+ let l = *between.expr.clone();+ let r = *between.expr;+ or(l.lt(*between.low), r.gt(*between.high))} else {- and(expr.clone().gt_eq(*low), expr.lt_eq(*high))+ and(+ between.expr.clone().gt_eq(*between.low),+ between.expr.lt_eq(*between.high),+ )}}expr => {@@ -1908,12 +1902,12 @@ mod tests {// ( c1 BETWEEN Int32(0) AND Int32(10) ) OR Boolean(NULL)// it can be either NULL or TRUE depending on the value of `c1 BETWEEN Int32(0) AND Int32(10)`// and should not be rewritten- let expr = Expr::Between {- expr: Box::new(col("c1")),- negated: false,- low: Box::new(lit(0)),- high: Box::new(lit(10)),- };+ let expr = Expr::Between(Between::new(+ Box::new(col("c1")),+ false,+ Box::new(lit(0)),+ Box::new(lit(10)),+ ));let expr = expr.or(lit_bool_null());let result = simplify(expr);@@ -1946,12 +1940,12 @@ mod tests {// c1 BETWEEN Int32(0) AND Int32(10) AND Boolean(NULL)// it can be either NULL or FALSE depending on the value of `c1 BETWEEN Int32(0) AND Int32(10)`// and the Boolean(NULL) should remain- let expr = Expr::Between {- expr: Box::new(col("c1")),- negated: false,- low: Box::new(lit(0)),- high: Box::new(lit(10)),- };+ let expr = Expr::Between(Between::new(+ Box::new(col("c1")),+ false,+ Box::new(lit(0)),+ Box::new(lit(10)),+ ));let expr = expr.and(lit_bool_null());let result = simplify(expr);@@ -1965,24 +1959,24 @@ mod tests {#[test]fn simplify_expr_between() {// c2 between 3 and 4 is c2 >= 3 and c2 <= 4- let expr = Expr::Between {- expr: Box::new(col("c2")),- negated: false,- low: Box::new(lit(3)),- high: Box::new(lit(4)),- };+ let expr = Expr::Between(Between::new(+ Box::new(col("c2")),+ false,+ Box::new(lit(3)),+ Box::new(lit(4)),+ ));assert_eq!(simplify(expr),and(col("c2").gt_eq(lit(3)), col("c2").lt_eq(lit(4))));// c2 not between 3 and 4 is c2 < 3 or c2 > 4- let expr = Expr::Between {- expr: Box::new(col("c2")),- negated: true,- low: Box::new(lit(3)),- high: Box::new(lit(4)),- };+ let expr = Expr::Between(Between::new(+ Box::new(col("c2")),+ true,+ Box::new(lit(3)),+ Box::new(lit(4)),+ ));assert_eq!(simplify(expr),or(col("c2").lt(lit(3)), col("c2").gt(lit(4)))@@ -2554,12 +2548,12 @@ mod tests {#[test]fn simplify_not_between() {let table_scan = test_table_scan();- let qual = Expr::Between {- expr: Box::new(col("d")),- negated: false,- low: Box::new(lit(1)),- high: Box::new(lit(10)),- };+ let qual = Expr::Between(Between::new(+ Box::new(col("d")),+ false,+ Box::new(lit(1)),+ Box::new(lit(10)),+ ));let plan = LogicalPlanBuilder::from(table_scan).filter(qual.not())@@ -2575,12 +2569,12 @@ mod tests {#[test]fn simplify_not_not_between() {let table_scan = test_table_scan();- let qual = Expr::Between {- expr: Box::new(col("d")),- negated: true,- low: Box::new(lit(1)),- high: Box::new(lit(10)),- };+ let qual = Expr::Between(Between::new(+ Box::new(col("d")),+ true,+ Box::new(lit(1)),+ Box::new(lit(10)),+ ));let plan = LogicalPlanBuilder::from(table_scan).filter(qual.not())diff --git a/datafusion/optimizer/src/type_coercion.rs b/datafusion/optimizer/src/type_coercion.rsindex f79b342462..d698f3354b 100644--- a/datafusion/optimizer/src/type_coercion.rs+++ b/datafusion/optimizer/src/type_coercion.rs@@ -21,7 +21,7 @@ use crate::utils::rewrite_preserving_name;use crate::{OptimizerConfig, OptimizerRule};use arrow::datatypes::DataType;use datafusion_common::{DFSchema, DFSchemaRef, DataFusionError, Result};-use datafusion_expr::expr::{Case, Like};+use datafusion_expr::expr::{Between, Case, Like};use datafusion_expr::expr_rewriter::{ExprRewriter, RewriteRecursion};use datafusion_expr::logical_plan::Subquery;use datafusion_expr::type_coercion::binary::{coerce_types, comparison_coercion};@@ -246,12 +246,12 @@ impl ExprRewriter for TypeCoercionRewriter {}}}- Expr::Between {+ Expr::Between(Between {expr,negated,low,high,- } => {+ }) => {let expr_type = expr.get_type(&self.schema)?;let low_type = low.get_type(&self.schema)?;let low_coerced_type = comparison_coercion(&expr_type, &low_type)@@ -277,12 +277,12 @@ impl ExprRewriter for TypeCoercionRewriter {expr_type, high_type))})?;- let expr = Expr::Between {- expr: Box::new(expr.cast_to(&coercion_type, &self.schema)?),+ let expr = Expr::Between(Between::new(+ Box::new(expr.cast_to(&coercion_type, &self.schema)?),negated,- low: Box::new(low.cast_to(&coercion_type, &self.schema)?),- high: Box::new(high.cast_to(&coercion_type, &self.schema)?),- };+ Box::new(low.cast_to(&coercion_type, &self.schema)?),+ Box::new(high.cast_to(&coercion_type, &self.schema)?),+ ));Ok(expr)}Expr::InList {diff --git a/datafusion/physical-expr/src/planner.rs b/datafusion/physical-expr/src/planner.rsindex 6a454f841f..742e10ec2c 100644--- a/datafusion/physical-expr/src/planner.rs+++ b/datafusion/physical-expr/src/planner.rs@@ -27,7 +27,7 @@ use crate::{};use arrow::datatypes::{DataType, Schema};use datafusion_common::{DFSchema, DataFusionError, Result, ScalarValue};-use datafusion_expr::{binary_expr, Expr, Like, Operator};+use datafusion_expr::{binary_expr, Between, Expr, Like, Operator};use std::sync::Arc;/// Create a physical expression from a logical expression ([Expr]).@@ -339,12 +339,12 @@ pub fn create_physical_expr(udf::create_physical_expr(fun.clone().as_ref(), &physical_args, input_schema)}- Expr::Between {+ Expr::Between(Between {expr,negated,low,high,- } => {+ }) => {let value_expr = create_physical_expr(expr,input_dfschema,diff --git a/datafusion/proto/src/from_proto.rs b/datafusion/proto/src/from_proto.rsindex b85ec2edae..ef640889dc 100644--- a/datafusion/proto/src/from_proto.rs+++ b/datafusion/proto/src/from_proto.rs@@ -40,8 +40,8 @@ use datafusion_expr::{regexp_replace, repeat, replace, reverse, right, round, rpad, rtrim, sha224, sha256,sha384, sha512, signum, sin, split_part, sqrt, starts_with, strpos, substr, tan,to_hex, to_timestamp_micros, to_timestamp_millis, to_timestamp_seconds, translate,- trim, trunc, upper, AggregateFunction, BuiltInWindowFunction, BuiltinScalarFunction,- Case, Expr, GroupingSet,+ trim, trunc, upper, AggregateFunction, Between, BuiltInWindowFunction,+ BuiltinScalarFunction, Case, Expr, GroupingSet,GroupingSet::GroupingSets,Like, Operator, WindowFrame, WindowFrameBound, WindowFrameUnits,};@@ -920,12 +920,12 @@ pub fn parse_expr(ExprType::IsNotUnknown(msg) => Ok(Expr::IsNotUnknown(Box::new(parse_required_expr(&msg.expr, registry, "expr")?,))),- ExprType::Between(between) => Ok(Expr::Between {- expr: Box::new(parse_required_expr(&between.expr, registry, "expr")?),- negated: between.negated,- low: Box::new(parse_required_expr(&between.low, registry, "expr")?),- high: Box::new(parse_required_expr(&between.high, registry, "expr")?),- }),+ ExprType::Between(between) => Ok(Expr::Between(Between::new(+ Box::new(parse_required_expr(&between.expr, registry, "expr")?),+ between.negated,+ Box::new(parse_required_expr(&between.low, registry, "expr")?),+ Box::new(parse_required_expr(&between.high, registry, "expr")?),+ ))),ExprType::Like(like) => Ok(Expr::Like(Like::new(like.negated,Box::new(parse_required_expr(&like.expr, registry, "expr")?),diff --git a/datafusion/proto/src/lib.rs b/datafusion/proto/src/lib.rsindex 8d6344b79d..bb9298c8fd 100644--- a/datafusion/proto/src/lib.rs+++ b/datafusion/proto/src/lib.rs@@ -63,7 +63,7 @@ mod roundtrip_tests {use datafusion::prelude::{create_udf, CsvReadOptions, SessionContext};use datafusion_common::{DFSchemaRef, DataFusionError, ScalarValue};use datafusion_expr::create_udaf;- use datafusion_expr::expr::{Case, GroupingSet, Like};+ use datafusion_expr::expr::{Between, Case, GroupingSet, Like};use datafusion_expr::logical_plan::{Extension, UserDefinedLogicalNode};use datafusion_expr::{col, lit, Accumulator, AggregateFunction, AggregateState,@@ -798,12 +798,12 @@ mod roundtrip_tests {#[test]fn roundtrip_between() {- let test_expr = Expr::Between {- expr: Box::new(lit(1.0_f32)),- negated: true,- low: Box::new(lit(2.0_f32)),- high: Box::new(lit(3.0_f32)),- };+ let test_expr = Expr::Between(Between::new(+ Box::new(lit(1.0_f32)),+ true,+ Box::new(lit(2.0_f32)),+ Box::new(lit(3.0_f32)),+ ));let ctx = SessionContext::new();roundtrip_expr_test(test_expr, ctx);diff --git a/datafusion/proto/src/to_proto.rs b/datafusion/proto/src/to_proto.rsindex 06a72eae26..279a6575f1 100644--- a/datafusion/proto/src/to_proto.rs+++ b/datafusion/proto/src/to_proto.rs@@ -34,7 +34,7 @@ use arrow::datatypes::{UnionMode,};use datafusion_common::{Column, DFField, DFSchemaRef, ScalarValue};-use datafusion_expr::expr::{GroupingSet, Like};+use datafusion_expr::expr::{Between, GroupingSet, Like};use datafusion_expr::{logical_plan::PlanType, logical_plan::StringifiedPlan, AggregateFunction,BuiltInWindowFunction, BuiltinScalarFunction, Expr, WindowFrame, WindowFrameBound,@@ -719,12 +719,12 @@ impl TryFrom<&Expr> for protobuf::LogicalExprNode {expr_type: Some(ExprType::IsNotUnknown(expr)),}}- Expr::Between {+ Expr::Between(Between {expr,negated,low,high,- } => {+ }) => {let expr = Box::new(protobuf::BetweenNode {expr: Some(Box::new(expr.as_ref().try_into()?)),negated: *negated,diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rsindex 6575445f01..e47e987f35 100644--- a/datafusion/sql/src/planner.rs+++ b/datafusion/sql/src/planner.rs@@ -51,7 +51,7 @@ use crate::utils::{make_decimal_type, normalize_ident, resolve_columns};use datafusion_common::{field_not_found, Column, DFSchema, DFSchemaRef, DataFusionError, Result, ScalarValue,};-use datafusion_expr::expr::{Case, GroupingSet, Like};+use datafusion_expr::expr::{Between, Case, GroupingSet, Like};use datafusion_expr::logical_plan::builder::project_with_alias;use datafusion_expr::logical_plan::{Filter, Subquery};use datafusion_expr::Expr::Alias;@@ -1955,12 +1955,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {negated,low,high,- } => Ok(Expr::Between {- expr: Box::new(self.sql_expr_to_logical_expr(*expr, schema, ctes)?),+ } => Ok(Expr::Between(Between::new(+ Box::new(self.sql_expr_to_logical_expr(*expr, schema, ctes)?),negated,- low: Box::new(self.sql_expr_to_logical_expr(*low, schema, ctes)?),- high: Box::new(self.sql_expr_to_logical_expr(*high, schema, ctes)?),- }),+ Box::new(self.sql_expr_to_logical_expr(*low, schema, ctes)?),+ Box::new(self.sql_expr_to_logical_expr(*high, schema, ctes)?),+ ))),SQLExpr::InList {expr,diff --git a/datafusion/sql/src/utils.rs b/datafusion/sql/src/utils.rsindex a786a21fc6..e7909f6cc6 100644--- a/datafusion/sql/src/utils.rs+++ b/datafusion/sql/src/utils.rs@@ -21,7 +21,7 @@ use arrow::datatypes::{DataType, DECIMAL128_MAX_PRECISION, DECIMAL_DEFAULT_SCALEuse sqlparser::ast::Ident;use datafusion_common::{DataFusionError, Result, ScalarValue};-use datafusion_expr::expr::{Case, GroupingSet, Like};+use datafusion_expr::expr::{Between, Case, GroupingSet, Like};use datafusion_expr::utils::{expr_as_column_expr, find_column_exprs};use datafusion_expr::{Expr, LogicalPlan};use std::collections::HashMap;@@ -207,17 +207,17 @@ whereBox::new(clone_with_replacement(nested_expr, replacement_fn)?),alias_name.clone(),)),- Expr::Between {- expr: nested_expr,+ Expr::Between(Between {+ expr,negated,low,high,- } => Ok(Expr::Between {- expr: Box::new(clone_with_replacement(nested_expr, replacement_fn)?),- negated: *negated,- low: Box::new(clone_with_replacement(low, replacement_fn)?),- high: Box::new(clone_with_replacement(high, replacement_fn)?),- }),+ }) => Ok(Expr::Between(Between::new(+ Box::new(clone_with_replacement(expr, replacement_fn)?),+ *negated,+ Box::new(clone_with_replacement(low, replacement_fn)?),+ Box::new(clone_with_replacement(high, replacement_fn)?),+ ))),Expr::InList {expr: nested_expr,list,