-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix bug: localtime is not thread-safe,then changed to localtime_r. #1614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
be/src/exec/base_scanner.cpp
Outdated
| 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()); | ||
| if (rawValue) {//is not null then get raw value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (rawValue) {//is not null then get raw value | |
| if (rawValue != nullptr) {//is not null then get raw value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
be/src/exec/base_scanner.cpp
Outdated
| << "while strict mode is " << std::boolalpha << _strict_mode; | ||
| _state->append_error_msg_to_file("", error_msg.str()); | ||
| } | ||
| LOG(WARNING) << error_msg.str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this log, we should not print error log for wrong data when load. This is a normal case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
| 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()); | ||
| } |
There was a problem hiding this comment.
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());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
be/src/exec/base_scanner.cpp
Outdated
| && !_src_tuple->is_null(_src_slot_descs_order_by_dest[dest_index]->null_indicator_offset())) { | ||
| SlotDescriptor* slotDescriptor = _src_slot_descs_order_by_dest[dest_index]; | ||
| if (_strict_mode && (slotDescriptor != nullptr)&& !_src_tuple->is_null(slotDescriptor->null_indicator_offset())) { | ||
| StringValue* rawValue = _src_tuple->get_string_slot(slotDescriptor->tuple_offset()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| StringValue* rawValue = _src_tuple->get_string_slot(slotDescriptor->tuple_offset()); | |
| StringValue* raw_value = _src_tuple->get_string_slot(slotDescriptor->tuple_offset()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
be/src/exec/base_scanner.cpp
Outdated
| 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* slotDescriptor = _src_slot_descs_order_by_dest[dest_index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SlotDescriptor* slotDescriptor = _src_slot_descs_order_by_dest[dest_index]; | |
| SlotDescriptor* slot_descriptor = _src_slot_descs_order_by_dest[dest_index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
imay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix bug: function localtime is not thread-safe,then changed to localtime_r.
Issue: #1615