amorynan commented on code in PR #15966:
URL: https://github.com/apache/doris/pull/15966#discussion_r1083389580


##########
be/src/olap/rowset/segment_v2/column_writer.cpp:
##########
@@ -173,6 +173,119 @@ Status ColumnWriter::create(const ColumnWriterOptions& 
opts, const TabletColumn*
             *writer = std::move(writer_local);
             return Status::OK();
         }
+       case FieldType::OLAP_FIELD_TYPE_MAP: {
+            DCHECK(column->get_subtype_count() == 2);
+            // todo . here key and value is array only?
+            const TabletColumn& key_column = column->get_sub_column(0); // 
field_type is true key and value
+            const TabletColumn& value_column = column->get_sub_column(1);
+
+            // create null writer
+            ScalarColumnWriter* null_writer = nullptr;
+            if (opts.meta->is_nullable()) {
+                FieldType null_type = FieldType::OLAP_FIELD_TYPE_TINYINT;
+                ColumnWriterOptions null_options;
+                null_options.meta = opts.meta->add_children_columns();
+                null_options.meta->set_column_id(3);
+                null_options.meta->set_unique_id(3);
+                null_options.meta->set_type(null_type);
+                null_options.meta->set_is_nullable(false);
+                null_options.meta->set_length(
+                        
get_scalar_type_info<OLAP_FIELD_TYPE_TINYINT>()->size());
+                null_options.meta->set_encoding(DEFAULT_ENCODING);
+                null_options.meta->set_compression(opts.meta->compression());
+
+                null_options.need_zone_map = false;
+                null_options.need_bloom_filter = false;
+                null_options.need_bitmap_index = false;
+
+                TabletColumn null_column = TabletColumn(
+                        OLAP_FIELD_AGGREGATION_NONE, null_type, false,
+                        null_options.meta->unique_id(), 
null_options.meta->length());
+                null_column.set_name("nullable");
+                null_column.set_index_length(-1); // no short key index
+                std::unique_ptr<Field> 
null_field(FieldFactory::create(null_column));
+                null_writer =
+                        new ScalarColumnWriter(null_options, 
std::move(null_field), file_writer);
+            }
+
+            // create key writer
+            std::unique_ptr<ColumnWriter> key_writer;
+           ColumnWriterOptions key_opts;
+            TabletColumn key_list_column(OLAP_FIELD_AGGREGATION_NONE, 
OLAP_FIELD_TYPE_ARRAY);
+            {
+               
key_list_column.add_sub_column(const_cast<TabletColumn&>(key_column));
+//                key_list_column.add_sub_column(key_column);
+                key_list_column.set_name("map.key");
+                key_list_column.set_index_length(-1);
+
+
+                key_opts.meta = opts.meta->mutable_children_columns(0);

Review Comment:
   but I need make new array columns as map key and value column writer because 
I need wrap actually typed column with array column which actually may not init 
in init_column_meta(), what shoud I deal with the 
column_id/unique_id/encoding/compression? 



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

Reply via email to