MCPcopy Create free account
hub / github.com/apache/arrow / GetStorageWithMetadata

Function GetStorageWithMetadata

cpp/src/arrow/c/bridge_test.cc:3838–3845  ·  view source on GitHub ↗

Given an extension type, return a field of its storage type + the serialized extension metadata.

Source from the content-addressed store, hash-verified

3836// Given an extension type, return a field of its storage type + the
3837// serialized extension metadata.
3838std::shared_ptr<Field> GetStorageWithMetadata(const std::string& field_name,
3839 const std::shared_ptr<DataType>& type) {
3840 const auto& ext_type = checked_cast<const ExtensionType&>(*type);
3841 auto storage_type = ext_type.storage_type();
3842 auto md = KeyValueMetadata::Make({kExtensionTypeKeyName, kExtensionMetadataKeyName},
3843 {ext_type.extension_name(), ext_type.Serialize()});
3844 return field(field_name, storage_type, /*nullable=*/true, md);
3845}
3846
3847TEST_F(TestSchemaRoundtrip, UnregisteredExtension) {
3848 TestWithTypeFactory(uuid, []() { return fixed_size_binary(16); });

Callers 1

TEST_FFunction · 0.85

Calls 5

storage_typeMethod · 0.80
MakeFunction · 0.50
fieldFunction · 0.50
extension_nameMethod · 0.45
SerializeMethod · 0.45

Tested by

no test coverage detected