xinlifoobar commented on code in PR #11330:
URL: https://github.com/apache/datafusion/pull/11330#discussion_r1685627761


##########
datafusion/sql/src/planner.rs:
##########
@@ -86,6 +88,35 @@ impl IdentNormalizer {
     }
 }
 
+/// Value Normalizer
+#[derive(Debug)]
+pub struct ValueNormalizer {
+    normalize: bool,
+}
+
+impl Default for ValueNormalizer {
+    fn default() -> Self {
+        Self { normalize: true }
+    }
+}
+
+impl ValueNormalizer {
+    pub fn new(normalize: bool) -> Self {
+        Self { normalize }
+    }
+
+    pub fn normalize(&self, value: Value) -> Result<String> {
+        if self.normalize {
+            crate::utils::normalize_value(&value)
+        } else {
+            match crate::utils::value_to_string(&value) {
+                Some(s) => Ok(s),
+                None => internal_err!("Unsupport value type to string: {:?}", 
value),
+            }
+        }
+    }
+}

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to