From 85e89b79d5ca57feda051432fc697a183be37465 Mon Sep 17 00:00:00 2001 From: EmmyMiao87 <522274284@qq.com> Date: Wed, 14 Aug 2019 19:58:09 +0800 Subject: [PATCH] Print src tuple in error_sample file (#1641) The src tuple could not be print in error_sample file when the value is filtered by strict mode. This commit fix this issue. --- be/src/exec/base_scanner.cpp | 9 +++++---- be/src/runtime/raw_value.cpp | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/be/src/exec/base_scanner.cpp b/be/src/exec/base_scanner.cpp index f9f45daee3..737c196736 100644 --- a/be/src/exec/base_scanner.cpp +++ b/be/src/exec/base_scanner.cpp @@ -154,9 +154,10 @@ bool BaseScanner::fill_dest_tuple(const Slice& line, Tuple* dest_tuple, MemPool* raw_string = raw_value->to_string(); } std::stringstream error_msg; - error_msg << " column(" << slot_desc->col_name() << ") value is incorrect " - << "while strict mode is " << std::boolalpha << _strict_mode; - _state->append_error_msg_to_file(raw_string, error_msg.str()); + error_msg << "column(" << slot_desc->col_name() << ") value is incorrect " + << "while strict mode is " << std::boolalpha << _strict_mode + << ", src value is " << raw_string; + _state->append_error_msg_to_file(_src_tuple_row->to_string(*(_row_desc.get())), error_msg.str()); _counter->num_rows_filtered++; return false; } @@ -164,7 +165,7 @@ bool BaseScanner::fill_dest_tuple(const Slice& line, Tuple* dest_tuple, MemPool* std::stringstream error_msg; error_msg << "column(" << slot_desc->col_name() << ") value is null " << "while columns is not nullable"; - _state->append_error_msg_to_file("", error_msg.str()); + _state->append_error_msg_to_file(_src_tuple_row->to_string(*(_row_desc.get())), error_msg.str()); _counter->num_rows_filtered++; return false; } diff --git a/be/src/runtime/raw_value.cpp b/be/src/runtime/raw_value.cpp index a06660ecb6..40a65e42bc 100644 --- a/be/src/runtime/raw_value.cpp +++ b/be/src/runtime/raw_value.cpp @@ -209,7 +209,9 @@ void RawValue::print_value(const void* value, const TypeDescriptor& type, int sc std::stringstream ss; ss << "ptr:" << (void*)string_val->ptr << " len" << string_val->len; tmp = ss.str(); - //tmp.assign(static_cast(string_val->ptr), string_val->len); + if (string_val->len <= 1000) { + tmp.assign(static_cast(string_val->ptr), string_val->len); + } str->swap(tmp); return; }