This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 7c833da  ARROW-8856: [Rust] [Integration] Return None from an empty 
IPC message
7c833da is described below

commit 7c833da14a33ea61e91b7b5bb87879f6e03a2e5b
Author: Neville Dipale <[email protected]>
AuthorDate: Thu May 21 17:36:29 2020 -0600

    ARROW-8856: [Rust] [Integration] Return None from an empty IPC message
    
    When an `ipc::MessageHeader` == `NONE` we should return 'Ok(None)' instead 
of an error.
    
    Please merge this after #7242
    
    Closes #7243 from nevi-me/ARROW-8856
    
    Authored-by: Neville Dipale <[email protected]>
    Signed-off-by: Andy Grove <[email protected]>
---
 rust/arrow/src/ipc/reader.rs | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/rust/arrow/src/ipc/reader.rs b/rust/arrow/src/ipc/reader.rs
index 25d4df2..9e766eb 100644
--- a/rust/arrow/src/ipc/reader.rs
+++ b/rust/arrow/src/ipc/reader.rs
@@ -680,10 +680,12 @@ impl<R: Read + Seek> FileReader<R> {
                         &self.dictionaries_by_field,
                     )
                 }
-                _ => Err(ArrowError::IoError(
-                    "Reading types other than record batches not yet supported"
-                        .to_string(),
-                )),
+                ipc::MessageHeader::NONE => {
+                    Ok(None)
+                }
+                t => Err(ArrowError::IoError(format!(
+                    "Reading types other than record batches not yet 
supported, unable to read {:?}", t
+                ))),
             }
         } else {
             Ok(None)
@@ -833,8 +835,11 @@ impl<R: Read> StreamReader<R> {
 
                 read_record_batch(&buf, batch, self.schema(), 
&self.dictionaries_by_field)
             }
-            _ => Err(ArrowError::IoError(
-                "Reading types other than record batches not yet 
supported".to_string(),
+            ipc::MessageHeader::NONE => {
+                Ok(None)
+            }
+            t => Err(ArrowError::IoError(
+                format!("Reading types other than record batches not yet 
supported, unable to read {:?} ", t)
             )),
         }
     }

Reply via email to