liukun4515 commented on code in PR #2586:
URL: https://github.com/apache/arrow-rs/pull/2586#discussion_r959121468
##########
arrow-flight/src/lib.rs:
##########
@@ -254,10 +254,17 @@ impl From<SchemaAsIpc<'_>> for FlightData {
}
}
-impl From<SchemaAsIpc<'_>> for SchemaResult {
- fn from(schema_ipc: SchemaAsIpc) -> Self {
- let IpcMessage(vals) = flight_schema_as_flatbuffer(schema_ipc.0,
schema_ipc.1);
Review Comment:
@tustvold
The original implementation has diff with the original implementation of
java.
The version of java has the length as the prefix for this buffer, but the
original rust does have the prefix length.
```
/**
* Write the serialized Message metadata, prefixed by the length, to the
output Channel. This
* ensures that it aligns to an 8 byte boundary and will adjust the
message length to include
* any padding used for alignment.
*
* @param out Output Channel
* @param messageLength Number of bytes in the message buffer, written as
little Endian prefix
* @param messageBuffer Message metadata buffer to be written, this does
not include any
* message body data which should be subsequently
written to the Channel
* @param option IPC write options
* @return Number of bytes written
* @throws IOException on error
*/
public static int writeMessageBuffer(WriteChannel out, int messageLength,
ByteBuffer messageBuffer, IpcOption option)
throws IOException {
// if write the pre-0.15.0 encapsulated IPC message format consisting of
a 4-byte prefix instead of 8 byte
int prefixSize = option.write_legacy_ipc_format ? 4 : 8;
// ensure that message aligns to 8 byte padding - prefix_size bytes,
then message body
if ((messageLength + prefixSize ) % 8 != 0) {
messageLength += 8 - (messageLength + prefixSize) % 8;
}
if (!option.write_legacy_ipc_format) {
out.writeIntLittleEndian(IPC_CONTINUATION_TOKEN);
}
out.writeIntLittleEndian(messageLength);
out.write(messageBuffer);
out.align();
// any bytes written are already captured by our size modification above
return messageLength + prefixSize;
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]