You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/12/18 20:06:56 UTC

[GitHub] [arrow] lidavidm commented on a change in pull request #8962: ARROW-10960: [C++] [Flight] Default to empty buffer instead of null

lidavidm commented on a change in pull request #8962:
URL: https://github.com/apache/arrow/pull/8962#discussion_r546065801



##########
File path: cpp/src/arrow/flight/serialization_internal.cc
##########
@@ -374,7 +374,18 @@ grpc::Status FlightDataDeserialize(ByteBuffer* buffer, FlightData* out) {
   buffer->Clear();
 
   // TODO(wesm): Where and when should we verify that the FlightData is not
-  // malformed or missing components?
+  // malformed?
+
+  // Set default values for unspecified FlightData fields
+  if (out->app_metadata == nullptr) {
+    out->app_metadata = std::make_shared<Buffer>(nullptr, 0);
+  }
+  if (out->metadata == nullptr) {
+    out->metadata = std::make_shared<Buffer>(nullptr, 0);
+  }

Review comment:
       I think the test failures might come from this, actually - if there's a metadata buffer, that causes some code to assume this must be a schema or record batch and try to parse it accordingly (but it'll then encounter the empty buffer and fail to parse it).
   
   Also, the app_metadata buffer can be omitted - it's meant to be optional so having an empty vs null one is no big deal.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org