github-actions[bot] commented on code in PR #18474:
URL: https://github.com/apache/doris/pull/18474#discussion_r1160654277


##########
be/src/vec/common/string_searcher.h:
##########
@@ -400,4 +400,65 @@
     }
 };
 
+template <typename StringSearcher>
+class MultiStringSearcherBase {
+private:
+    /// needles and their offsets
+    const std::vector<StringRef>& needles;
+    /// searchers
+    std::vector<StringSearcher> searchers;
+    /// last index of offsets that was not processed
+    size_t last;
+
+public:
+    explicit MultiStringSearcherBase(const std::vector<StringRef>& needles_)

Review Comment:
   warning: use of undeclared identifier 'StringRef' [clang-diagnostic-error]
   ```cpp
       explicit MultiStringSearcherBase(const std::vector<StringRef>& needles_)
                                                          ^
   ```
   



##########
be/src/vec/common/string_searcher.h:
##########
@@ -400,4 +400,65 @@ struct LibCASCIICaseInsensitiveStringSearcher : public 
StringSearcherBase {
     }
 };
 
+template <typename StringSearcher>
+class MultiStringSearcherBase {
+private:
+    /// needles and their offsets
+    const std::vector<StringRef>& needles;

Review Comment:
   warning: use of undeclared identifier 'StringRef' [clang-diagnostic-error]
   ```cpp
       const std::vector<StringRef>& needles;
                         ^
   ```
   



##########
be/src/vec/common/string_searcher.h:
##########
@@ -400,4 +400,65 @@
     }
 };
 
+template <typename StringSearcher>
+class MultiStringSearcherBase {
+private:
+    /// needles and their offsets
+    const std::vector<StringRef>& needles;
+    /// searchers
+    std::vector<StringSearcher> searchers;
+    /// last index of offsets that was not processed
+    size_t last;
+
+public:
+    explicit MultiStringSearcherBase(const std::vector<StringRef>& needles_)
+            : needles {needles_}, last {0} {
+        searchers.reserve(needles.size());
+
+        size_t size = needles.size();
+        for (int i = 0; i < size; ++i) {
+            const char* cur_needle_data = needles[i].data;
+            const size_t cur_needle_size = needles[i].size;
+
+            searchers.emplace_back(cur_needle_data, cur_needle_size);
+        }
+    }
+
+    /**
+     * while (hasMoreToSearch())
+     * {
+     *     search inside the haystack with the known needles
+     * }
+     */
+    bool hasMoreToSearch() {
+        if (last >= needles.size()) return false;

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
           if (last >= needles.size()) { return false;
   }
   ```
   



##########
be/src/vec/common/string_searcher.h:
##########
@@ -400,4 +400,65 @@
     }
 };
 
+template <typename StringSearcher>
+class MultiStringSearcherBase {
+private:
+    /// needles and their offsets
+    const std::vector<StringRef>& needles;
+    /// searchers
+    std::vector<StringSearcher> searchers;
+    /// last index of offsets that was not processed
+    size_t last;
+
+public:
+    explicit MultiStringSearcherBase(const std::vector<StringRef>& needles_)
+            : needles {needles_}, last {0} {
+        searchers.reserve(needles.size());
+
+        size_t size = needles.size();
+        for (int i = 0; i < size; ++i) {
+            const char* cur_needle_data = needles[i].data;
+            const size_t cur_needle_size = needles[i].size;
+
+            searchers.emplace_back(cur_needle_data, cur_needle_size);
+        }
+    }
+
+    /**
+     * while (hasMoreToSearch())
+     * {
+     *     search inside the haystack with the known needles
+     * }
+     */
+    bool hasMoreToSearch() {
+        if (last >= needles.size()) return false;
+
+        return true;
+    }
+
+    bool searchOne(const uint8_t* haystack, const uint8_t* haystack_end) {
+        const size_t size = needles.size();
+        if (last >= size) return false;

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
           if (last >= size) { return false;
   }
   ```
   



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to