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/17 02:38:32 UTC

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

BiteTheDDDDt commented on code in PR #15945:
URL: https://github.com/apache/doris/pull/15945#discussion_r1071687390


##########
be/src/vec/exprs/table_function/vexplode_split.cpp:
##########
@@ -63,17 +80,34 @@ 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();
+            auto last = strv.end();
+
+            do {
+                const auto second =
+                        std::search(first, last, std::cbegin(delims), std::cend(delims));
+                if (first != second) {
+                    output.emplace_back(strv.substr(std::distance(strv.begin(), first),
+                                                    std::distance(first, second)));
+                    first = std::next(second);
+                } else {
+                    output.emplace_back("", 0);
+                    first = std::next(second, delims.size());
+                }
+
+                if (second == last) break;

Review Comment:
   need fix



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