github-actions[bot] commented on code in PR #67784:
URL: https://github.com/apache/doris/pull/67784#discussion_r4057110731


##########
be/src/core/data_type_serde/data_type_map_serde.cpp:
##########
@@ -440,6 +441,98 @@ Status DataTypeMapSerDe::write_column_to_arrow(const 
IColumn& column, const Null
     return Status::OK();
 }
 
+namespace {
+
+template <typename WriteKey, typename WriteValue>
+Status write_map_column_to_target(const IColumn& column, const NullMap* 
null_map,
+                                  arrow::ArrayBuilder* array_builder, int64_t 
start, int64_t end,
+                                  WriteKey&& write_key, WriteValue&& 
write_value) {
+    auto& builder = assert_cast<arrow::MapBuilder&>(*array_builder);
+    const auto& map_column = assert_cast<const ColumnMap&>(column);
+    const IColumn& nested_keys_column = map_column.get_keys();
+    const IColumn& nested_values_column = map_column.get_values();
+    DCHECK(nested_keys_column.is_nullable());
+    DCHECK(nested_values_column.is_nullable());
+    const auto* keys_nullmap_data =
+            
check_and_get_column<ColumnNullable>(nested_keys_column)->get_null_map_data().data();
+    const auto& offsets = map_column.get_offsets();

Review Comment:
   [P1] Guard required map keys before dereferencing the nullable cast
   
   `check_and_get_column<ColumnNullable>(nested_keys_column)` is dereferenced 
unconditionally here, although map keys are not required to be nullable. 
`DataTypeMap::create_column()` and TableReader nullability alignment can 
produce a plain key column (for example a Paimon map whose key is 
non-nullable), so this returns null and crashes the BE in release builds before 
the row loop. Please handle plain keys without a null-map lookup (or 
normalize/validate the child and return a Status), and add a Paimon/Iceberg map 
writer test with a non-nullable key.



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