You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "airborne12 (via GitHub)" <gi...@apache.org> on 2023/06/02 03:38:39 UTC

[GitHub] [doris] airborne12 commented on a diff in pull request #20344: [fix](match query) fix array column match query failed without inverted index

airborne12 commented on code in PR #20344:
URL: https://github.com/apache/doris/pull/20344#discussion_r1213882467


##########
be/src/vec/functions/match.cpp:
##########
@@ -119,13 +162,28 @@ Status FunctionMatchAll::execute_match(const std::string& column_name,
                      << ", please check your query sql";
         return Status::Error<ErrorCode::INVERTED_INDEX_NO_TERMS>();
     }
+
+    auto current_src_array_offset = 0;
     for (int i = 0; i < input_rows_count; i++) {
-        const auto& str_ref = datas->get_data_at(i);
-        std::vector<std::wstring> data_tokens =
-                doris::segment_v2::InvertedIndexReader::get_analyse_result(
-                        column_name, str_ref.to_string(),
-                        doris::segment_v2::InvertedIndexQueryType::MATCH_ALL_QUERY,
-                        inverted_index_ctx);
+        std::vector<std::wstring> data_tokens;
+        if (array_offsets) {
+            for (auto next_src_array_offset = (*array_offsets)[i];
+                 current_src_array_offset < next_src_array_offset; ++current_src_array_offset) {
+                const auto& str_ref = string_col->get_data_at(current_src_array_offset);
+                std::vector<std::wstring> element_tokens =
+                        doris::segment_v2::InvertedIndexReader::get_analyse_result(
+                                column_name, str_ref.to_string(),
+                                doris::segment_v2::InvertedIndexQueryType::MATCH_ALL_QUERY,
+                                inverted_index_ctx);
+                data_tokens.insert(data_tokens.end(), element_tokens.begin(), element_tokens.end());
+            }
+        } else {
+            const auto& str_ref = string_col->get_data_at(i);
+            data_tokens = doris::segment_v2::InvertedIndexReader::get_analyse_result(
+                    column_name, str_ref.to_string(),
+                    doris::segment_v2::InvertedIndexQueryType::MATCH_ALL_QUERY, inverted_index_ctx);

Review Comment:
   Repeated code with MATCH_ANY?



-- 
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-unsubscribe@doris.apache.org

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


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