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 a31786e20a remove old unimplemented() for scientific notaion (#6142)
a31786e20a is described below

commit a31786e20a5bed6c27630fc3d65da52fea8ea423
Author: Yongting You <2010you...@gmail.com>
AuthorDate: Fri Apr 28 07:39:50 2023 -0700

    remove old unimplemented() for scientific notaion (#6142)
---
 .../core/tests/sqllogictests/test_files/scalar.slt | 37 ++++++++++++++++++++++
 datafusion/sql/src/expr/value.rs                   |  9 +-----
 2 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/datafusion/core/tests/sqllogictests/test_files/scalar.slt 
b/datafusion/core/tests/sqllogictests/test_files/scalar.slt
index 7583600802..12248f894f 100644
--- a/datafusion/core/tests/sqllogictests/test_files/scalar.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/scalar.slt
@@ -820,3 +820,40 @@ drop table test_boolean
 
 statement ok
 drop table test_int32
+
+# scientific notation (0s)
+query RRRR
+SELECT 0e0 AS c1, 0.e-0 AS c2, -.0e+0 AS c3, 00.00e-00 AS c4
+----
+0 0 0 0
+
+# scientific notation (integer)
+query RRRR
+SELECT -1e-1, 0e100, 10E-2, 1E+0;
+----
+-0.1 0 0.1 1
+
+# scientific notation (decimal)
+query RRRR
+SELECT -1.5e-1, 00.0e1, 150.0E-3, 0.015E+2;
+----
+-0.15 0 0.15 1.5
+
+# scientific notation (integer or decimal part only)
+query RRRR
+SELECT -2.e-1, 0.e0, .0002E+3, .02E+2;
+----
+-0.2 0 0.2 2
+
+# scientific notation (overflows)
+# FLOAT64 range: -1.79E+308 to -2.22E-308, or from 2.22E-308 to 1.79E+308
+query RRRR
+SELECT -1.79e309, -2.22e-309, 2.22E-309, 1.79E+309;
+----
+-Infinity 0 0 Infinity
+
+# scientific notation (other edgecases)
+query IRRR
+SELECT 1ea, 1e-2a, 1E-2-2, 1E-1e2;
+----
+1 0.01 -1.99 0.1
diff --git a/datafusion/sql/src/expr/value.rs b/datafusion/sql/src/expr/value.rs
index c936313e20..df9e44be3f 100644
--- a/datafusion/sql/src/expr/value.rs
+++ b/datafusion/sql/src/expr/value.rs
@@ -47,14 +47,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
 
     /// Parse number in sql string, convert to Expr::Literal
     fn parse_sql_number(&self, n: &str) -> Result<Expr> {
-        if n.find('E').is_some() {
-            // not implemented yet
-            // https://github.com/apache/arrow-datafusion/issues/3448
-            Err(DataFusionError::NotImplemented(
-                "sql numeric literals in scientific notation are not supported"
-                    .to_string(),
-            ))
-        } else if let Ok(n) = n.parse::<i64>() {
+        if let Ok(n) = n.parse::<i64>() {
             Ok(lit(n))
         } else if self.options.parse_float_as_decimal {
             // remove leading zeroes

Reply via email to