yiguolei commented on code in PR #10506:
URL: https://github.com/apache/doris/pull/10506#discussion_r910590598


##########
be/src/olap/rowset/segment_v2/binary_plain_page.h:
##########
@@ -254,6 +254,33 @@ class BinaryPlainPageDecoder : public PageDecoder {
         return Status::OK();
     };
 
+    Status read_by_rowids(const rowid_t* rowids, ordinal_t page_first_ordinal, 
size_t* n,
+                          vectorized::MutableColumnPtr& dst) override {
+        DCHECK(_parsed);
+        if (PREDICT_FALSE(*n == 0)) {
+            *n = 0;
+            return Status::OK();
+        }
+
+        auto data = _data.mutable_data();
+        auto total = *n;
+        size_t read_count = 0;
+        for (size_t i = 0; i < total; ++i) {
+            ordinal_t ord = rowids[i] - page_first_ordinal;
+            if (UNLIKELY(ord >= _num_elems)) {
+                *n = read_count;
+                return Status::OK();
+            }
+
+            const uint32_t start_offset = offset(ord);
+            dst->insert_data(data + start_offset, offset(ord + 1) - 
start_offset);

Review Comment:
   There is performance issues.  For column string, it will call resize and 
memcpy too many times.
   You can do a seperate loop to calculate the string size and resize the 
column and then insert data.



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