You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2020/04/14 12:15:26 UTC

[incubator-doris] branch master updated: [Doris on ES] Fix bug: when Doris and ES type not match (#3315)

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

zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 6889279  [Doris on ES] Fix bug: when Doris and ES type not match (#3315)
6889279 is described below

commit 688927918cf9ab4f590b2a50decf9e7d464b6f60
Author: 令狐少侠 <bl...@163.com>
AuthorDate: Tue Apr 14 20:15:13 2020 +0800

    [Doris on ES] Fix bug: when Doris and ES type not match (#3315)
---
 be/src/exec/es/es_scroll_parser.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/be/src/exec/es/es_scroll_parser.cpp b/be/src/exec/es/es_scroll_parser.cpp
index 29512a5..fbbcfb7 100644
--- a/be/src/exec/es/es_scroll_parser.cpp
+++ b/be/src/exec/es/es_scroll_parser.cpp
@@ -104,6 +104,17 @@ static const string ERROR_COL_DATA_IS_ARRAY = "Data source returned an array for
         } \
     } while (false)
 
+#define RETURN_ERROR_IF_COL_IS_NOT_NUMBER(col, type) \
+    do { \
+        if (!col.IsNumber()) { \
+            std::stringstream ss; \
+            ss << "Expected value of type: " \
+               << type_to_string(type) \
+               << "; but found type: " <<json_type_to_string(col.GetType()) \
+               << "; Document value is: " << json_value_to_string(col); \
+            return Status::RuntimeError(ss.str()); \
+        } \
+     } while (false)
 
 #define RETURN_ERROR_IF_PARSING_FAILED(result, col, type) \
     do { \
@@ -129,14 +140,13 @@ static const string ERROR_COL_DATA_IS_ARRAY = "Data source returned an array for
 
 template <typename T>
 static Status get_int_value(const rapidjson::Value &col, PrimitiveType type, void* slot, bool pure_doc_value) {
-
-
     if (col.IsNumber()) {
         *reinterpret_cast<T*>(slot) = (T)(sizeof(T) < 8 ? col.GetInt() : col.GetInt64());
         return Status::OK();
     }
 
     if (pure_doc_value && col.IsArray()) {
+        RETURN_ERROR_IF_COL_IS_NOT_NUMBER(col[0], type);
         *reinterpret_cast<T*>(slot) = (T)(sizeof(T) < 8 ? col[0].GetInt() : col[0].GetInt64());
         return Status::OK();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org