From 43bb9de190d03d961bea8230a8ea3b849f61762a Mon Sep 17 00:00:00 2001 From: worker24h Date: Thu, 8 Aug 2019 19:47:43 +0800 Subject: [PATCH] Fix bug: localtime is not thread-safe,then changed to localtime_r. --- be/src/exec/base_scanner.cpp | 17 ++++++++++++----- be/src/exec/parquet_reader.cpp | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/be/src/exec/base_scanner.cpp b/be/src/exec/base_scanner.cpp index 0e16fe38ae7647..f9f45daee353c8 100644 --- a/be/src/exec/base_scanner.cpp +++ b/be/src/exec/base_scanner.cpp @@ -18,6 +18,7 @@ #include "base_scanner.h" +#include "common/logging.h" #include "runtime/descriptors.h" #include "runtime/mem_tracker.h" #include "runtime/raw_value.h" @@ -144,12 +145,18 @@ bool BaseScanner::fill_dest_tuple(const Slice& line, Tuple* dest_tuple, MemPool* ExprContext* ctx = _dest_expr_ctx[dest_index]; void* value = ctx->get_value(_src_tuple_row); if (value == nullptr) { - if (_strict_mode && (_src_slot_descs_order_by_dest[dest_index] != nullptr) - && !_src_tuple->is_null(_src_slot_descs_order_by_dest[dest_index]->null_indicator_offset())) { + SlotDescriptor* slot_descriptor = _src_slot_descs_order_by_dest[dest_index]; + if (_strict_mode && (slot_descriptor != nullptr)&& !_src_tuple->is_null(slot_descriptor->null_indicator_offset())) { + //Type of the slot is must be Varchar in _src_tuple. + StringValue* raw_value = _src_tuple->get_string_slot(slot_descriptor->tuple_offset()); + std::string raw_string; + if (raw_value != nullptr) {//is not null then get raw value + 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("", error_msg.str()); + 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()); _counter->num_rows_filtered++; return false; } diff --git a/be/src/exec/parquet_reader.cpp b/be/src/exec/parquet_reader.cpp index b91d14713364fd..795688f0ea964e 100644 --- a/be/src/exec/parquet_reader.cpp +++ b/be/src/exec/parquet_reader.cpp @@ -194,9 +194,9 @@ Status ParquetReaderWrap::handle_timestamp(const std::shared_ptr