Apache DataFusion SQL Query Engine
Rename `ParamValues::{LIST -> List,MAP -> Map}` (#8611)
Tomoaki Kawada0e62fa4df924
diff --git a/datafusion/common/src/param_value.rs b/datafusion/common/src/param_value.rsindex 253c312b66..1b6195c0d0 100644--- a/datafusion/common/src/param_value.rs+++ b/datafusion/common/src/param_value.rs@@ -23,17 +23,17 @@ use std::collections::HashMap;/// The parameter value corresponding to the placeholder#[derive(Debug, Clone)]pub enum ParamValues {- /// for positional query parameters, like select * from test where a > $1 and b = $2- LIST(Vec<ScalarValue>),- /// for named query parameters, like select * from test where a > $foo and b = $goo- MAP(HashMap<String, ScalarValue>),+ /// For positional query parameters, like `SELECT * FROM test WHERE a > $1 AND b = $2`+ List(Vec<ScalarValue>),+ /// For named query parameters, like `SELECT * FROM test WHERE a > $foo AND b = $goo`+ Map(HashMap<String, ScalarValue>),}impl ParamValues {/// Verify parameter list length and typepub fn verify(&self, expect: &Vec<DataType>) -> Result<()> {match self {- ParamValues::LIST(list) => {+ ParamValues::List(list) => {// Verify if the number of params matches the number of valuesif expect.len() != list.len() {return _plan_err!(@@ -57,7 +57,7 @@ impl ParamValues {}Ok(())}- ParamValues::MAP(_) => {+ ParamValues::Map(_) => {// If it is a named query, variables can be reused,// but the lengths are not necessarily equalOk(())@@ -71,7 +71,7 @@ impl ParamValues {data_type: &Option<DataType>,) -> Result<ScalarValue> {match self {- ParamValues::LIST(list) => {+ ParamValues::List(list) => {if id.is_empty() || id == "$0" {return _plan_err!("Empty placeholder id");}@@ -97,7 +97,7 @@ impl ParamValues {}Ok(value.clone())}- ParamValues::MAP(map) => {+ ParamValues::Map(map) => {// convert name (in format $a, $b, ..) to mapped values (a, b, ..)let name = &id[1..];// value at the name position in param_values should be the value for the placeholder@@ -122,7 +122,7 @@ impl ParamValues {impl From<Vec<ScalarValue>> for ParamValues {fn from(value: Vec<ScalarValue>) -> Self {- Self::LIST(value)+ Self::List(value)}}@@ -133,7 +133,7 @@ wherefn from(value: Vec<(K, ScalarValue)>) -> Self {let value: HashMap<String, ScalarValue> =value.into_iter().map(|(k, v)| (k.into(), v)).collect();- Self::MAP(value)+ Self::Map(value)}}@@ -144,6 +144,6 @@ wherefn from(value: HashMap<K, ScalarValue>) -> Self {let value: HashMap<String, ScalarValue> =value.into_iter().map(|(k, v)| (k.into(), v)).collect();- Self::MAP(value)+ Self::Map(value)}}