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

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


The following commit(s) were added to refs/heads/master by this push:
     new 503618f  chore: rearrange the code and add comment (#2037)
503618f is described below

commit 503618fb9405d58ad11d060a12f17fb14ea3ba17
Author: jakevin <[email protected]>
AuthorDate: Sun Mar 20 04:06:27 2022 +0800

    chore: rearrange the code and add comment (#2037)
---
 datafusion/src/sql/planner.rs | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/datafusion/src/sql/planner.rs b/datafusion/src/sql/planner.rs
index 8d944ee..8f0b873 100644
--- a/datafusion/src/sql/planner.rs
+++ b/datafusion/src/sql/planner.rs
@@ -2226,6 +2226,14 @@ pub fn convert_data_type(sql_type: &SQLDataType) -> 
Result<DataType> {
     }
 }
 
+// Parse number in sql string, convert to Expr::Literal
+fn parse_sql_number(n: &str) -> Result<Expr> {
+    match n.parse::<i64>() {
+        Ok(n) => Ok(lit(n)),
+        Err(_) => Ok(lit(n.parse::<f64>().unwrap())),
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use crate::datasource::empty::EmptyTable;
@@ -4019,10 +4027,3 @@ mod tests {
         assert_eq!(expected, format!("{}", result));
     }
 }
-
-fn parse_sql_number(n: &str) -> Result<Expr> {
-    match n.parse::<i64>() {
-        Ok(n) => Ok(lit(n)),
-        Err(_) => Ok(lit(n.parse::<f64>().unwrap())),
-    }
-}

Reply via email to