diff --git a/datafusion/common/src/param_value.rs b/datafusion/common/src/param_value.rs index 1b6195c0d0bc..004c1371d1ae 100644 --- a/datafusion/common/src/param_value.rs +++ b/datafusion/common/src/param_value.rs @@ -31,7 +31,7 @@ pub enum ParamValues { impl ParamValues { /// Verify parameter list length and type - pub fn verify(&self, expect: &Vec) -> Result<()> { + pub fn verify(&self, expect: &[DataType]) -> Result<()> { match self { ParamValues::List(list) => { // Verify if the number of params matches the number of values @@ -67,8 +67,8 @@ impl ParamValues { pub fn get_placeholders_with_values( &self, - id: &String, - data_type: &Option, + id: &str, + data_type: Option<&DataType>, ) -> Result { match self { ParamValues::List(list) => { @@ -88,7 +88,7 @@ impl ParamValues { )) })?; // check if the data type of the value matches the data type of the placeholder - if Some(value.data_type()) != *data_type { + if Some(&value.data_type()) != data_type { return _internal_err!( "Placeholder value type mismatch: expected {:?}, got {:?}", data_type, @@ -107,7 +107,7 @@ impl ParamValues { )) })?; // check if the data type of the value matches the data type of the placeholder - if Some(value.data_type()) != *data_type { + if Some(&value.data_type()) != data_type { return _internal_err!( "Placeholder value type mismatch: expected {:?}, got {:?}", data_type, diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs index 1f3711407a14..50f4a6b76e18 100644 --- a/datafusion/expr/src/logical_plan/plan.rs +++ b/datafusion/expr/src/logical_plan/plan.rs @@ -1250,8 +1250,8 @@ impl LogicalPlan { expr.transform(&|expr| { match &expr { Expr::Placeholder(Placeholder { id, data_type }) => { - let value = - param_values.get_placeholders_with_values(id, data_type)?; + let value = param_values + .get_placeholders_with_values(id, data_type.as_ref())?; // Replace the placeholder with the value Ok(Transformed::Yes(Expr::Literal(value))) }