This is an automated email from the ASF dual-hosted git repository.

bkietz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 31feee92 fix: Ensure that schema metadata is always present even if 
empty (#591)
31feee92 is described below

commit 31feee92712e2216828d1ff5c4d685501a197bd2
Author: Benjamin Kietzman <[email protected]>
AuthorDate: Thu Aug 22 09:33:45 2024 -0500

    fix: Ensure that schema metadata is always present even if empty (#591)
    
    An absent Schema.custom_metadata was causing flatcc to produce invalid
    flatbuffers on s390x. For now, just populate that field with an empty
    vector
---
 src/nanoarrow/ipc/encoder.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/nanoarrow/ipc/encoder.c b/src/nanoarrow/ipc/encoder.c
index 890fe65e..13b72c74 100644
--- a/src/nanoarrow/ipc/encoder.c
+++ b/src/nanoarrow/ipc/encoder.c
@@ -428,13 +428,13 @@ static ArrowErrorCode 
ArrowIpcEncodeSchema(flatcc_builder_t* builder,
                                                &ns(Schema_fields_push_end), 
error));
   FLATCC_RETURN_UNLESS_0(Schema_fields_end(builder), error);
 
+  FLATCC_RETURN_UNLESS_0(Schema_custom_metadata_start(builder), error);
   if (schema->metadata) {
-    FLATCC_RETURN_UNLESS_0(Schema_custom_metadata_start(builder), error);
     NANOARROW_RETURN_NOT_OK(
         ArrowIpcEncodeMetadata(builder, schema, 
&ns(Schema_custom_metadata_push_start),
                                &ns(Schema_custom_metadata_push_end), error));
-    FLATCC_RETURN_UNLESS_0(Schema_custom_metadata_end(builder), error);
   }
+  FLATCC_RETURN_UNLESS_0(Schema_custom_metadata_end(builder), error);
 
   FLATCC_RETURN_UNLESS_0(Schema_features_start(builder), error);
   FLATCC_RETURN_UNLESS_0(Schema_features_end(builder), error);

Reply via email to