Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions be/src/exec/base_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I think you can reuse the append string logic.

std::string raw_string;
if (raw_value != nullptr) {
raw_string = raw_value->to_string();
}
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());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

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;
}
Expand Down
6 changes: 3 additions & 3 deletions be/src/exec/parquet_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ Status ParquetReaderWrap::handle_timestamp(const std::shared_ptr<arrow::Timestam
default:
return Status::InternalError("Invalid Time Type.");
}
tm* local;
local = localtime(&timestamp);
*wbytes = (uint32_t)strftime((char*)buf, 64, "%Y-%m-%d %H:%M:%S", local);
struct tm local;
localtime_r(&timestamp, &local);
*wbytes = (uint32_t)strftime((char*)buf, 64, "%Y-%m-%d %H:%M:%S", &local);
return Status::OK();
}

Expand Down