This is an automated email from the ASF dual-hosted git repository.

weizuo pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new ea0700e454 Revert "[Performance] Optimize performance of like expr 
(#15168)" (#16619)
ea0700e454 is described below

commit ea0700e45498a3fe12df92a71697e60fd8a6b441
Author: Henry2SS <45096548+henry...@users.noreply.github.com>
AuthorDate: Thu Feb 16 11:39:47 2023 +0800

    Revert "[Performance] Optimize performance of like expr (#15168)" (#16619)
    
    This reverts commit 8f6c8ec5cd5d2452ce3d1dd7a678028e9bc91c40.
---
 be/src/runtime/string_search.hpp | 8 +++++---
 be/src/vec/functions/like.cpp    | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/be/src/runtime/string_search.hpp b/be/src/runtime/string_search.hpp
index 14800f2903..3f657b6fa4 100644
--- a/be/src/runtime/string_search.hpp
+++ b/be/src/runtime/string_search.hpp
@@ -41,11 +41,13 @@ public:
             return -1;
         }
 
-        char* occurence = std::strstr(str->ptr, _pattern->ptr);
-        if (occurence == nullptr) {
+        auto it = std::search(str->ptr, str->ptr + str->len,
+                              std::default_searcher(_pattern->ptr, 
_pattern->ptr + _pattern->len));
+        if (it == str->ptr + str->len) {
             return -1;
+        } else {
+            return it - str->ptr;
         }
-        return occurence - str->ptr;
     }
 
 private:
diff --git a/be/src/vec/functions/like.cpp b/be/src/vec/functions/like.cpp
index f0c37787ad..c6bf479582 100644
--- a/be/src/vec/functions/like.cpp
+++ b/be/src/vec/functions/like.cpp
@@ -76,7 +76,7 @@ Status 
FunctionLikeBase::constant_substring_fn(LikeSearchState* state, const Str
         *result = true;
         return Status::OK();
     }
-    StringValue pattern_value(val.ptr, val.len);
+    StringValue pattern_value = StringValue::from_string_val(val.ptr);
     *result = state->substring_pattern.search(&pattern_value) != -1;
     return Status::OK();
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to