Phoenix500526 commented on code in PR #10277:
URL: https://github.com/apache/arrow-rs/pull/10277#discussion_r3568244117
##########
arrow-ipc/src/writer.rs:
##########
@@ -2522,6 +2773,89 @@ mod tests {
stream_reader.next().unwrap().unwrap()
}
+ fn encode_stream(
+ schema: &Schema,
+ batches: &[RecordBatch],
+ options: IpcWriteOptions,
+ ) -> Vec<u8> {
+ let mut encoder = StreamEncoder::try_new_with_options(schema,
options).unwrap();
+ let mut bytes = Vec::new();
+ for batch in batches {
+ for buffer in encoder.encode(batch).unwrap() {
+ bytes.extend_from_slice(buffer.as_slice());
+ }
+ }
+ for buffer in encoder.finish().unwrap() {
+ bytes.extend_from_slice(buffer.as_slice());
+ }
+ bytes
+ }
+
+ fn write_stream(schema: &Schema, batches: &[RecordBatch], options:
IpcWriteOptions) -> Vec<u8> {
+ let mut bytes = Vec::new();
+ let mut writer = StreamWriter::try_new_with_options(&mut bytes,
schema, options).unwrap();
+ for batch in batches {
+ writer.write(batch).unwrap();
+ }
+ writer.finish().unwrap();
+ bytes
+ }
+
+ // StreamEncoder and StreamWriter currently use separate encoding paths,
so these tests
+ // verify the new sans-IO API preserves the existing IPC stream byte
layout.
+ #[test]
Review Comment:
Done
--
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]