chaoyli closed pull request #397: Fix bug that null value will be loaded to 
non-nullable column
URL: https://github.com/apache/incubator-doris/pull/397
 
 
   

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/exec/csv_scan_node.cpp b/be/src/exec/csv_scan_node.cpp
index fa52b44f..3b11f7f4 100644
--- a/be/src/exec/csv_scan_node.cpp
+++ b/be/src/exec/csv_scan_node.cpp
@@ -478,6 +478,7 @@ bool CsvScanNode::check_and_write_text_slot(
         const char* value, int value_length,
         const SlotDescriptor* slot, RuntimeState* state,
         std::stringstream* error_msg) {
+
     if (value_length == 0 && !slot->type().is_string_type()) {
         (*error_msg) << "the length of input should not be 0. "
                 << "column_name: " << column_name << "; "
@@ -491,6 +492,13 @@ bool CsvScanNode::check_and_write_text_slot(
         return true;
     }
 
+    if (!slot->is_nullable() && is_null(value, value_length)) {
+        (*error_msg) << "value cannot be null. column name: " << column_name
+                << "; type: " << slot->type() << "; input_str: ["
+                << std::string(value, value_length) << "].";
+        return false;
+    }
+
     char* value_to_convert = const_cast<char*>(value);
     int value_to_convert_length = value_length;
 


 

----------------------------------------------------------------
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