bkietz commented on code in PR #39866:
URL: https://github.com/apache/arrow/pull/39866#discussion_r1476308890
##########
cpp/src/arrow/c/bridge_test.cc:
##########
@@ -3693,13 +3693,23 @@ TEST_F(TestSchemaRoundtrip, Dictionary) {
}
}
+std::shared_ptr<Field> GetStorageWithMetadata(const std::string& field_name,
+ const std::shared_ptr<DataType>&
type) {
+ const auto& ext_type = checked_cast<const ExtensionType&>(*type);
+ auto storage_type = ext_type.storage_type();
+ auto md = KeyValueMetadata::Make({kExtensionTypeKeyName,
kExtensionMetadataKeyName},
+ {ext_type.extension_name(),
ext_type.Serialize()});
+ return field(field_name, storage_type, /*nullable=*/true, md);
+}
+
TEST_F(TestSchemaRoundtrip, UnregisteredExtension) {
TestWithTypeFactory(uuid, []() { return fixed_size_binary(16); });
TestWithTypeFactory(dict_extension_type, []() { return dictionary(int8(),
utf8()); });
// Inside nested type
- TestWithTypeFactory([]() { return list(dict_extension_type()); },
- []() { return list(dictionary(int8(), utf8())); });
+ TestWithTypeFactory(
+ []() { return list(dict_extension_type()); },
+ []() { return list(GetStorageWithMetadata("item",
dict_extension_type())); });
Review Comment:
Would you mind adding a comment explaining why the nested metadata is
present ?
##########
cpp/src/arrow/util/key_value_metadata.cc:
##########
@@ -188,7 +186,7 @@ std::vector<std::pair<std::string, std::string>>
KeyValueMetadata::sorted_pairs(
return pairs;
}
-int KeyValueMetadata::FindKey(const std::string& key) const {
+int KeyValueMetadata::FindKey(std::string_view key) const {
Review Comment:
:+1:
--
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]