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 2020/03/13 15:09:03 UTC

[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #3025: Restructure storage type to support complex types expending

kangkaisen commented on a change in pull request #3025: Restructure storage type to support complex types expending
URL: https://github.com/apache/incubator-doris/pull/3025#discussion_r392268958
 
 

 ##########
 File path: be/src/olap/rowset/segment_v2/column_writer.cpp
 ##########
 @@ -361,5 +430,106 @@ Status ColumnWriter::_finish_current_page() {
     return Status::OK();
 }
 
+////////////////////////////////////////////////////////////////////////////////
+
+ListColumnWriter::ListColumnWriter(const ColumnWriterOptions& opts,
+                         std::unique_ptr<Field> field,
+                         WritableFile* output_file,
+                         std::unique_ptr<ColumnWriter> item_writer):
+        ColumnWriter(opts, std::move(field), output_file), _item_writer(std::move(item_writer)) {}
+
+Status ListColumnWriter::create_page_builder(PageBuilder** page_builder) {
+    TypeInfo* bigint_type_info = get_scalar_type_info(FieldType::OLAP_FIELD_TYPE_BIGINT);
+    RETURN_IF_ERROR(EncodingInfo::get(bigint_type_info, _opts.meta->encoding(), &_encoding_info));
+
+    PageBuilder* local = nullptr;
+    PageBuilderOptions opts;
+    opts.data_page_size = _opts.data_page_size;
+    _opts.meta->set_encoding(_encoding_info->encoding());
+
+    RETURN_IF_ERROR(_encoding_info->create_page_builder(opts, &local));
+    if (local == nullptr) {
+        return Status::NotSupported(
+                Substitute("Failed to create page builder for type LIST encoding $0",
+                           _opts.meta->encoding()));
+    } else {
+        *page_builder = local;
+        return Status::OK();
+    }
+}
+ListColumnWriter::~ListColumnWriter() = default;
+
+Status ListColumnWriter::init() {
+    if (_opts.need_zone_map) {
+        return Status::NotSupported("unsupported zone map for list");
+    }
+
+    if (_opts.need_bitmap_index) {
+        return Status::NotSupported("unsupported bitmap for list");
+    }
+
+    if (_opts.need_bloom_filter) {
+        return Status::NotSupported("unsupported bloom filter for list");
+    }
+
+    RETURN_IF_ERROR(ColumnWriter::init());
+    RETURN_IF_ERROR(_item_writer->init());
+    return Status::OK();
+}
+
+Status ListColumnWriter::put_page_footer_info(DataPageFooterPB* footer) {
+    footer->set_next_array_item_ordinal(_next_item_ordinal);
+    return Status::OK();
 }
+
+// Now we can only write data one by one.
+Status ListColumnWriter::_append_data(const uint8_t** ptr, size_t num_rows) {
+    size_t remaining = num_rows;
+    const auto* col_cursor = reinterpret_cast<const collection*>(*ptr);
+    while (remaining > 0) {
+        size_t num_written = 1;
 
 Review comment:
   Why not add 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org