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


##########
be/src/vec/olap/olap_data_convertor.cpp:
##########
@@ -810,30 +808,52 @@ Status 
OlapBlockDataConvertor::OlapColumnDataConvertorMap::convert_to_olap(
         const ColumnMap* column_map, const DataTypeMap* data_type_map) {
     ColumnPtr key_data = column_map->get_keys_ptr();
     ColumnPtr value_data = column_map->get_values_ptr();
+    const UInt8* key_null_map = nullptr;
+    const UInt8* val_null_map = nullptr;
     if (column_map->get_keys().is_nullable()) {
         const auto& key_nullable_column =
                 assert_cast<const ColumnNullable&>(column_map->get_keys());
         key_data = key_nullable_column.get_nested_column_ptr();
+        key_null_map = key_nullable_column.get_null_map_data().data();
     }
 
     if (column_map->get_values().is_nullable()) {
         const auto& val_nullable_column =
                 assert_cast<const ColumnNullable&>(column_map->get_values());
         value_data = val_nullable_column.get_nested_column_ptr();
+        val_null_map = val_nullable_column.get_null_map_data().data();
     }
 
-    ColumnWithTypeAndName key_typed_column = {key_data, 
remove_nullable(data_type_map->get_keys()),
-                                              "map.key"};
-    _key_convertor->set_source_column(key_typed_column, _row_pos, _num_rows);
+    // offsets data
+    auto& offsets = column_map->get_offsets();
+    // make first offset
+    auto offsets_col = ColumnArray::ColumnOffsets::create();
+
+    _offsets.reserve(offsets.size() + 1);
+    _offsets.push_back(_row_pos);
+    _offsets.insert_assume_reserved(offsets.begin(), offsets.end());
+
+    int64_t start_index = _row_pos - 1;
+    int64_t end_index = _row_pos + _num_rows - 1;
+    auto start = offsets[start_index];
+    auto size = offsets[end_index] - start;
+
+    ColumnWithTypeAndName key_typed_column = {
+            key_data, remove_nullable(data_type_map->get_key_type()), 
"map.key"};
+    _key_convertor->set_source_column(key_typed_column, start, size);
     _key_convertor->convert_to_olap();
 
     ColumnWithTypeAndName value_typed_column = {
-            value_data, remove_nullable(data_type_map->get_values()), 
"map.value"};
-    _value_convertor->set_source_column(value_typed_column, _row_pos, 
_num_rows);
+            value_data, remove_nullable(data_type_map->get_value_type()), 
"map.value"};
+    _value_convertor->set_source_column(value_typed_column, start, size);
     _value_convertor->convert_to_olap();
 
-    _results[0] = _key_convertor->get_data();
-    _results[1] = _value_convertor->get_data();
+    _results[0] = (void*)size;
+    _results[1] = _offsets.data();
+    _results[2] = _key_convertor->get_data();

Review Comment:
   I think this order is more convenience  go through for k data and nullmap  
and   v data and nullmap   one by one in column_writer , I will reorder this 
misleading annotate.



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

Reply via email to