alinaliBQ commented on code in PR #48050:
URL: https://github.com/apache/arrow/pull/48050#discussion_r2621167863


##########
cpp/src/arrow/flight/sql/column_metadata.cc:
##########
@@ -58,8 +58,10 @@ const char* ColumnMetadata::kIsSearchable = 
"ARROW:FLIGHT:SQL:IS_SEARCHABLE";
 const char* ColumnMetadata::kRemarks = "ARROW:FLIGHT:SQL:REMARKS";
 
 ColumnMetadata::ColumnMetadata(
-    std::shared_ptr<const arrow::KeyValueMetadata> metadata_map)
-    : metadata_map_(std::move(metadata_map)) {}
+    std::shared_ptr<const arrow::KeyValueMetadata> metadata_map) {
+  metadata_map_ = std::move(metadata_map ? metadata_map
+                                         : 
std::make_shared<arrow::KeyValueMetadata>());
+}

Review Comment:
   In the original implementation, `metadata_map_` would be nullptr if 
`metadata_map` is null. Downstream might assume `metadata_map_` is always 
non-null, so it is safer to create an empty map if  `metadata_map` is null.



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

Reply via email to