cambyzju commented on code in PR #23779:
URL: https://github.com/apache/doris/pull/23779#discussion_r1315333804
##########
be/src/olap/rowset/segment_v2/column_writer.cpp:
##########
@@ -731,6 +731,48 @@ Status ScalarColumnWriter::finish_current_page() {
////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+// offset column writer
+////////////////////////////////////////////////////////////////////////////////
+
+OffsetColumnWriter::OffsetColumnWriter(const ColumnWriterOptions& opts,
+ std::unique_ptr<Field> field,
io::FileWriter* file_writer)
+ : ScalarColumnWriter(opts, std::move(field), file_writer) {
+ // now we only explain data in offset column as uint64
+ DCHECK(field->type() == FieldType::OLAP_FIELD_TYPE_UNSIGNED_BIGINT);
+}
+
+OffsetColumnWriter::~OffsetColumnWriter() = default;
+
+Status OffsetColumnWriter::init() {
+ RETURN_IF_ERROR(ScalarColumnWriter::init());
+ register_flush_page_callback(this);
+ _next_offset = 0;
+ return Status::OK();
+}
+
+Status OffsetColumnWriter::append_data(const uint8_t** ptr, size_t num_rows) {
+ size_t remaining = num_rows;
+ while (remaining > 0) {
+ size_t num_written = remaining;
+ RETURN_IF_ERROR(append_data_in_current_page(ptr, &num_written));
+ // _next_offset after append_data_in_current_page is the offset of
next data, which will used in finish_current_page() to set
next_array_item_ordinal
+ _next_offset = *(const uint64_t*)(*ptr);
Review Comment:
offset should convert to: item_batch_begin_rowid + offset
item_batch_begin_rowid = _item_writer->get_next_rowid() before item append
batch.
--
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]