You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by GitBox <gi...@apache.org> on 2019/04/29 06:28:29 UTC
[GitHub] [incubator-doris] chenhao7253886 commented on a change in pull
request #1070: Fix bug that null value is not correctly handled when
loading data
chenhao7253886 commented on a change in pull request #1070: Fix bug that null value is not correctly handled when loading data
URL: https://github.com/apache/incubator-doris/pull/1070#discussion_r279246542
##########
File path: be/src/exec/olap_table_info.h
##########
@@ -105,12 +105,25 @@ struct OlapTablePartition {
class OlapTablePartKeyComparator {
public:
OlapTablePartKeyComparator(SlotDescriptor* slot_desc) : _slot_desc(slot_desc) { }
+ // return true if lhs < rhs
+ // 'nullptr' is max value, but 'null' is min value
bool operator()(const Tuple* lhs, const Tuple* rhs) const {
if (lhs == nullptr) {
return false;
} else if (rhs == nullptr) {
return true;
}
+
+ bool lhs_null = lhs->is_null(_slot_desc->null_indicator_offset());
+ bool rhs_null = rhs->is_null(_slot_desc->null_indicator_offset());
+ if (lhs_null && rhs_null) {
+ return false;
+ } else if (lhs_null) {
+ return true;
+ } else if (rhs_null) {
+ return false;
+ }
+
Review comment:
It exists some redundant if. you can change to
if (rhs_null) {
return false;
} else if (lhs_null) {
return true;
}
or
if (lhs_null || rhs_null) {
return rhs_null? false : true;
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@doris.apache.org
For additional commands, e-mail: dev-help@doris.apache.org