This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 0e62fa4df9 Rename `ParamValues::{LIST -> List,MAP -> Map}` (#8611)
0e62fa4df9 is described below

commit 0e62fa4df924f8657e43a97ca7aa8c6ca48bc08f
Author: Tomoaki Kawada <[email protected]>
AuthorDate: Fri Dec 22 21:47:14 2023 +0900

    Rename `ParamValues::{LIST -> List,MAP -> Map}` (#8611)
    
    * Rename `ParamValues::{LIST -> List,MAP -> Map}`
    
    
<https://rust-lang.github.io/api-guidelines/naming.html#casing-conforms-to-rfc-430-c-case>
    
    * Reformat the doc comments of `ParamValues::*`
---
 datafusion/common/src/param_value.rs | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/datafusion/common/src/param_value.rs 
b/datafusion/common/src/param_value.rs
index 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 type
     pub 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 values
                 if 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 equal
                 Ok(())
@@ -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 @@ where
     fn 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 @@ where
     fn 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)
     }
 }

Reply via email to