HappenLee commented on code in PR #35628: URL: https://github.com/apache/doris/pull/35628#discussion_r1627421320
########## be/src/olap/rowset/segment_v2/column_writer.cpp: ########## @@ -88,267 +88,305 @@ class NullBitmapBuilder { RleEncoder<bool> _rle_encoder; }; +Status ColumnWriter::create_struct_writer(const ColumnWriterOptions& opts, + const TabletColumn* column, io::FileWriter* file_writer, + std::unique_ptr<ColumnWriter>* writer) { + // not support empty struct + DCHECK(column->get_subtype_count() >= 1); + std::vector<std::unique_ptr<ColumnWriter>> sub_column_writers; + sub_column_writers.reserve(column->get_subtype_count()); + for (uint32_t i = 0; i < column->get_subtype_count(); i++) { + const TabletColumn& sub_column = column->get_sub_column(i); + + // create sub writer + ColumnWriterOptions column_options; + column_options.meta = opts.meta->mutable_children_columns(i); + column_options.need_zone_map = false; + column_options.need_bloom_filter = sub_column.is_bf_column(); + column_options.need_bitmap_index = sub_column.has_bitmap_index(); + if (sub_column.type() == FieldType::OLAP_FIELD_TYPE_STRUCT) { + if (column_options.need_bloom_filter) { + return Status::NotSupported("Do not support bloom filter for struct type"); + } + if (column_options.need_bitmap_index) { + return Status::NotSupported("Do not support bitmap index for struct type"); + } + } + if (sub_column.type() == FieldType::OLAP_FIELD_TYPE_ARRAY) { + if (column_options.need_bloom_filter) { + return Status::NotSupported("Do not support bloom filter for array type"); + } + if (column_options.need_bitmap_index) { + return Status::NotSupported("Do not support bitmap index for array type"); + } + } + std::unique_ptr<ColumnWriter> sub_column_writer; + RETURN_IF_ERROR( + ColumnWriter::create(column_options, &sub_column, file_writer, &sub_column_writer)); + sub_column_writers.push_back(std::move(sub_column_writer)); + } + + // if nullable, create null writer + ScalarColumnWriter* null_writer = nullptr; + if (opts.meta->is_nullable()) { + FieldType null_type = FieldType::OLAP_FIELD_TYPE_TINYINT; Review Comment: should we simple the to a function, also do the work in array/map writer -- 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