Carol Nichols created ARROW-10960:
-------------------------------------

             Summary: [C++] [Flight] Missing protobuf data_body should result 
in default value of empty bytes, not null
                 Key: ARROW-10960
                 URL: https://issues.apache.org/jira/browse/ARROW-10960
             Project: Apache Arrow
          Issue Type: Bug
          Components: FlightRPC
            Reporter: Carol Nichols
         Attachments: cpp-client-empty-data-body.png, 
rust-client-missing-data-body.png

h1. Problem

ProtoBuf {{proto3}} specifies that [if a message does not contain a particular 
singular element, the field should get the default 
value|https://developers.google.com/protocol-buffers/docs/proto3#default]. 
However, when the C++ {{flight-test-integration-server}} gets a {{DoPut}} 
request with a {{FlightData}} message for a record batch containing no items, 
and the {{FlightData}} is missing the {{data_body}} field, the server responds 
with an error "Expected body in IPC message of type record batch".

h2. What happens

If I run the C++ {{flight-test-integration-server}} and the C++ 
{{flight-test-integration-client}} with the {{generated_null_trivial}} test 
case, the test passes and I see the protobuf in wireshark shown in the 
cpp-client-empty-data-body.png attachment.

Note the {{data_body}} field is present but has no value.

If I run the Rust {{flight-test-integration-client}} that I'm working on 
developing, it does not send the {{data_body}} field at all if there are no 
bytes to send. I see the protobuf in wireshark shown in the 
rust-client-missing-data-body.png attachment.

Note the {{data_body}} field is not present.

The C++ server then returns the error message "Expected body in IPC message of 
type record batch", which comes from [this check for message 
body|https://github.com/apache/arrow/blob/519e9da4fc1698f686525f4226295f3680a3f3db/cpp/src/arrow/ipc/reader.cc#L92]
 called in [{{ReadNext}} of the record batch stream 
reader|https://github.com/apache/arrow/blob/519e9da4fc1698f686525f4226295f3680a3f3db/cpp/src/arrow/ipc/reader.cc#L787].

h2.  What I expect to happen

Instead of returning an error message because of a null pointer, the Message 
should get the default value of empty bytes.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to