chenhao7253886 closed pull request #401: Fix bug that null value will be loaded
to non-nullable column
URL: https://github.com/apache/incubator-doris/pull/401
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..1dbf0e2b 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 << "; "
@@ -486,9 +487,16 @@ bool CsvScanNode::check_and_write_text_slot(
return false;
}
- if (slot->is_nullable() && is_null(value, value_length)) {
- _tuple->set_null(slot->null_indicator_offset());
- return true;
+ if (is_null(value, value_length)) {
+ if (slot->is_nullable()) {
+ _tuple->set_null(slot->null_indicator_offset());
+ return true;
+ } else {
+ (*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);
----------------------------------------------------------------
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]