This is an automated email from the ASF dual-hosted git repository.
gabriellee pushed a commit to branch opt_perf
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/opt_perf by this push:
new 22085b265b [Improvement](string) Optimize string comparion (#12947)
22085b265b is described below
commit 22085b265bd3feef4d23b8dbe75edb1e878a8438
Author: Gabriel <[email protected]>
AuthorDate: Sun Sep 25 00:36:26 2022 +0800
[Improvement](string) Optimize string comparion (#12947)
---
be/src/runtime/string_value.h | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/be/src/runtime/string_value.h b/be/src/runtime/string_value.h
index 13b3852a5d..fe5d6df5c5 100644
--- a/be/src/runtime/string_value.h
+++ b/be/src/runtime/string_value.h
@@ -137,7 +137,12 @@ struct StringValue {
return string_compare(this->ptr, this->len, other.ptr, other.len,
this->len) == 0;
}
- bool operator==(const StringValue& other) const { return eq(other); }
+ bool operator==(const StringValue& other) const {
+ if (this->len == 0 && other.len == 0) {
+ return true;
+ }
+ return eq(other);
+ }
// !=
bool ne(const StringValue& other) const { return !eq(other); }
// <=
@@ -149,7 +154,12 @@ struct StringValue {
// >
bool gt(const StringValue& other) const { return compare(other) > 0; }
- bool operator!=(const StringValue& other) const { return ne(other); }
+ bool operator!=(const StringValue& other) const {
+ if (this->len == 0 && other.len == 0) {
+ return false;
+ }
+ return ne(other);
+ }
bool operator<=(const StringValue& other) const { return le(other); }
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]