Skip to content

Commit

Permalink
chore: Always export extension metadata (#94)
Browse files Browse the repository at this point in the history
Apparently Arrow C++ will throw an exception if you register an
extension type with metadata but attempt to create an instance *without*
metadata.
  • Loading branch information
paleolimbot authored May 20, 2024
1 parent 7d9dc2f commit 73c6078
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/geoarrow/geoarrow_arrow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ class VectorExtensionType : public arrow::ExtensionType {

std::string Serialize() const override { return type_.extension_metadata(); }

std::string ToString() const override { return arrow::ExtensionType::ToString(); }

const VectorType& GeoArrowType() const { return type_; }

arrow::Result<std::shared_ptr<VectorExtensionType>> WithGeometryType(
Expand Down
7 changes: 7 additions & 0 deletions src/geoarrow/schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ GeoArrowErrorCode GeoArrowSchemaInitExtension(struct ArrowSchema* schema,
return result;
}

result = ArrowMetadataBuilderAppend(
&metadata, ArrowCharView("ARROW:extension:metadata"), ArrowCharView("{}"));
if (result != NANOARROW_OK) {
ArrowBufferReset(&metadata);
return result;
}

result = GeoArrowSchemaInit(schema, type);
if (result != NANOARROW_OK) {
ArrowBufferReset(&metadata);
Expand Down

0 comments on commit 73c6078

Please sign in to comment.