imay closed pull request #428: Report error when loading decimal value with 
scientific notation
URL: https://github.com/apache/incubator-doris/pull/428
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/be/src/runtime/decimal_value.cpp b/be/src/runtime/decimal_value.cpp
index c54e2c5f..3ce57313 100755
--- a/be/src/runtime/decimal_value.cpp
+++ b/be/src/runtime/decimal_value.cpp
@@ -900,26 +900,27 @@ int DecimalValue::parse_from_str(const char* decimal_str, 
int32_t length) {
         *buff = value * powers10[DIG_PER_DEC1 - index_in_powers10];
     }
 
-    // Handle exponent
+    // TODO: we do not support decimal in scientific notation
     if ((frac_ptr + 1) < end && (*frac_ptr == 'e' || *frac_ptr == 'E')) {
-        int64_t exponent = strtoll(frac_ptr + 1, (char**) end, 10);
-        if (end != frac_ptr + 1) { // If at least one digit
-            if (errno) { // system error number, it is thread local
-                set_to_zero();
-                return E_DEC_BAD_NUM;
-            }
-            if (exponent > (INT_MAX / 2) || (errno == 0 && exponent < 0)) {
-                set_to_zero();
-                return E_DEC_OVERFLOW;
-            }
-            if (exponent < INT_MAX / 2 && error != E_DEC_OVERFLOW) {
-                set_to_zero();
-                return E_DEC_TRUNCATED;
-            }
-            if (error != E_DEC_OVERFLOW) {
-                // error = shift((int32_t) exponent);
-            }
-        }
+        return E_DEC_BAD_NUM;
+        // int64_t exponent = strtoll(frac_ptr + 1, (char**) &end, 10);
+        // if (end != frac_ptr + 1) { // If at least one digit
+        //     if (errno) { // system error number, it is thread local
+        //         set_to_zero();
+        //         return E_DEC_BAD_NUM;
+        //     }
+        //     if (exponent > (INT_MAX / 2) || (errno == 0 && exponent < 0)) {
+        //         set_to_zero();
+        //         return E_DEC_OVERFLOW;
+        //     }
+        //     if (exponent < INT_MAX / 2 && error != E_DEC_OVERFLOW) {
+        //         set_to_zero();
+        //         return E_DEC_TRUNCATED;
+        //     }
+        //     if (error != E_DEC_OVERFLOW) {
+        //         // error = shift((int32_t) exponent);
+        //     }
+        // }
     }
     if (_sign && is_zero()) {
         _sign = false;
diff --git a/docs/help/Contents/Data Definition/ddl_stmt.md 
b/docs/help/Contents/Data Definition/ddl_stmt.md
index 12a1968d..79734bcf 100644
--- a/docs/help/Contents/Data Definition/ddl_stmt.md    
+++ b/docs/help/Contents/Data Definition/ddl_stmt.md    
@@ -58,12 +58,15 @@
                             LARGEINT(16字节)
                                 范围:0 ~ 2^127 - 1
                             FLOAT(4字节)
+                                支持科学计数法
                             DOUBLE(12字节)
+                                支持科学计数法
                             DECIMAL[(precision, scale)] (40字节)
                                 保证精度的小数类型。默认是 DECIMAL(10, 0)
                                 precision: 1 ~ 27
                                 scale: 0 ~ 9
                                 其中整数部分为 1 ~ 18
+                                不支持科学计数法
                             DATE(3字节)
                                 范围:1900-01-01 ~ 9999-12-31
                             DATETIME(8字节)
diff --git a/docs/help/Contents/Data Manipulation/manipulation_stmt.md 
b/docs/help/Contents/Data Manipulation/manipulation_stmt.md
index 95650621..92d517a1 100644
--- a/docs/help/Contents/Data Manipulation/manipulation_stmt.md 
+++ b/docs/help/Contents/Data Manipulation/manipulation_stmt.md 
@@ -380,6 +380,7 @@
                             NOTE: 需要进行url编码,譬如
                             需要指定'\t'为分隔符,那么应该传入'column_separator=%09'
                             需要指定'\x01'为分隔符,那么应该传入'column_separator=%01'
+                            需要指定','为分隔符,那么应该传入'column_separator=%2c'
 
 
         max_filter_ratio:   用于指定允许过滤不规范数据的最大比例,默认是0,不允许过滤


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to