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:
[email protected]