Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions datafusion/common/src/param_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum ParamValues {

impl ParamValues {
/// Verify parameter list length and type
pub fn verify(&self, expect: &Vec<DataType>) -> Result<()> {
pub fn verify(&self, expect: &[DataType]) -> Result<()> {
match self {
ParamValues::List(list) => {
// Verify if the number of params matches the number of values
Expand Down Expand Up @@ -67,8 +67,8 @@ impl ParamValues {

pub fn get_placeholders_with_values(
&self,
id: &String,
data_type: &Option<DataType>,
id: &str,
data_type: Option<&DataType>,
) -> Result<ScalarValue> {
match self {
ParamValues::List(list) => {
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
Expand Down