You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/15 15:22:48 UTC

[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15945: [Exec](opt) Opt the vexplode_split function performance

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


##########
be/src/vec/exprs/table_function/vexplode_split.cpp:
##########
@@ -63,17 +80,35 @@ Status VExplodeSplitTableFunction::process_row(size_t row_idx) {
     _is_current_empty = false;
     _eos = false;
 
-    StringRef text = _text_column->get_data_at(row_idx);
-    StringRef delimiter = _delimiter_column->get_data_at(row_idx);
-
-    if (text.data == nullptr) {
+    if ((!_test_null_map and _test_null_map[row_idx]) || _delimiter.data == nullptr) {
         _is_current_empty = true;
         _cur_size = 0;
         _cur_offset = 0;
     } else {
-        //TODO: implement non-copy split string reference
-        _backup = strings::Split(StringPiece((char*)text.data, text.size),
-                                 StringPiece((char*)delimiter.data, delimiter.size));
+        auto split =[] (std::string_view strv, std::string_view delims = " ")
+        {
+            std::vector<std::string_view> output;
+            auto first = strv.begin();
+
+            while (first != strv.end())
+            {
+                const auto second = std::find_first_of(first, std::cend(strv),
+                                                       std::cbegin(delims), std::cend(delims));
+                //std::cout << first << ", " << second << '\n';
+                if (first != second)
+                {
+                    output.emplace_back(strv.substr(std::distance(strv.begin(), first), std::distance(first, second)));
+                }
+
+                if (second == strv.end())
+                    break;

Review Comment:
   warning: statement should be inside braces [readability-braces-around-statements]
   
   ```suggestion
                   if (second == strv.end()) {
                       break;
   }
   ```
   



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