adonis0147 commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894654169


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, 
ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, 
vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = 
vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? 
static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = 
column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);
+    auto& column_offsets =
+            
static_cast<vectorized::ColumnArray::ColumnOffsets&>(*column_offsets_ptr);
+    auto& offsets_data = column_offsets.get_data();
+    for (int i = start; i < offsets_data.size(); ++i) {
+        offsets_data[i] += offsets_data[i - 1]; // -1 is ok
+    }
+
+    auto column_items_ptr = column_array->get_data().assume_mutable();
+    for (int64_t i = start; i < offsets_data.size(); ++i) {
+        auto offset = offsets_data[i - 1]; // -1 is ok.
+        auto size = offsets_data[i] - offset;
+        if (size == 0) {
+            continue;
+        }
+        size_t num_items = size;
+        bool items_has_null = false;
+        _item_iterator->next_batch(&num_items, column_items_ptr, 
&items_has_null);

Review Comment:
   Refined.



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