eldenmoon commented on code in PR #12293:
URL: https://github.com/apache/doris/pull/12293#discussion_r969415507
##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -466,6 +486,42 @@ Status ArrayFileColumnIterator::next_batch(size_t* n,
ColumnBlockView* dst, bool
return Status::OK();
}
+Status ArrayFileColumnIterator::_seek_by_offsets(ordinal_t ord) {
+ // using offsets info
+ ordinal_t offset = 0;
+ RETURN_IF_ERROR(_peek_one_offset(&offset));
+ RETURN_IF_ERROR(_item_iterator->seek_to_ordinal(offset));
+ return Status::OK();
+}
+
+Status ArrayFileColumnIterator::seek_to_ordinal(ordinal_t ord) {
+ RETURN_IF_ERROR(_offset_iterator->seek_to_ordinal(ord));
+ if (_array_reader->is_nullable()) {
+ RETURN_IF_ERROR(_null_iterator->seek_to_ordinal(ord));
+ }
+ return _seek_by_offsets(ord);
+}
+
+Status ArrayFileColumnIterator::_caculate_offsets(ssize_t start,
+
vectorized::MutableColumnPtr& offsets,
+ size_t* num_items) {
+ auto& column_offsets =
static_cast<vectorized::ColumnArray::ColumnOffsets&>(*offsets);
+ ordinal_t last_offset = 0;
+ RETURN_IF_ERROR(_peek_one_offset(&last_offset));
+
+ auto& offsets_data = column_offsets.get_data();
+ *num_items = last_offset - offsets_data[start];
Review Comment:
I think both would be ok, since if we put the assignment of `num_items`
outside the function, we need to do one more cast
`static_cast<vectorized::ColumnArray::ColumnOffsets&>(*offsets)`, this seems a
little duplicated code, num_items as a output of `_calculate_offsets` may be
straightforward?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]