You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/06/09 16:11:55 UTC

[GitHub] [arrow] eyalleshem opened a new pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

eyalleshem opened a new pull request #7384:
URL: https://github.com/apache/arrow/pull/7384


   …ional) 0xFFFFFFFF 0x00000000


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] andygrove commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
andygrove commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r438868762



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       nit: could you remove the `return` statements?
   
   perhaps:
   
   ```rust
   if e.kind() == std::io::ErrorKind::UnexpectedEof {
     ...
     Ok(None)
   } else {
     Err(ArrowError::from(e))
   }
   ```
   
   Another option:
   
   ```rust
   Err(e) if e.kind() == std::io::ErrorKind::UnexpectedEof => {
     ...
     Ok(None)
   }
   Err(e) => Err(ArrowError::from(e))
   ```
   




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] nevi-me closed pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
nevi-me closed pull request #7384:
URL: https://github.com/apache/arrow/pull/7384


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] eyalleshem commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
eyalleshem commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r438898154



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       I don't think that i could remove return  , As it's not the last statement of the function .  
   
   for example i tried this : 
   
   ```
   if let Err(e) = self.reader.read_exact(&mut meta_size) {
               if e.kind() == std::io::ErrorKind::UnexpectedEof {
                   // Handle EOF without the "0xFFFFFFFF 0x00000000"
                   // valid according to:
                   // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
                   self.finished = true;
                   Ok(None)
               } else {
                   Err(ArrowError::from(e))
   
   ```            }
          } 
   }
   
   
   but the complier complain : 
   `expected `()`, found enum `std::result::Result`` 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] andygrove commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
andygrove commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r438909250



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       One last option to consider:
   
   ```rust
   return if e.kind() == std::io::ErrorKind::UnexpectedEof {
       ...
       Ok(None)
   } else {
       Err(ArrowError::from(e))
   }
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] andygrove commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
andygrove commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r438905928



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       I see. This is returning from the whole function not the match .. ok, never mind then and thanks for looking at it. 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] github-actions[bot] commented on pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#issuecomment-641383006


   https://issues.apache.org/jira/browse/ARROW-9082


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] eyalleshem commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
eyalleshem commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r439304801



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] eyalleshem commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
eyalleshem commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r438898154



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       I don't think that i could remove return  , As it's not the last statement of the function .  
   
   for example i tried this : 
   
   ```
   if let Err(e) = self.reader.read_exact(&mut meta_size) {
               if e.kind() == std::io::ErrorKind::UnexpectedEof {
                   // Handle EOF without the "0xFFFFFFFF 0x00000000"
                   // valid according to:
                   // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
                   self.finished = true;
                   Ok(None)
               } else {
                   Err(ArrowError::from(e))
   
               }
          } 
   }
   ```
   
   but the complier complain : 
   ```expected `()`, found enum `std::result::Result``` 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] eyalleshem commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
eyalleshem commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r438898154



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       I don't think that i could remove return  , As it's not the last statement of the function .  
   
   for example i tried this : 
   
   ```
   if let Err(e) = self.reader.read_exact(&mut meta_size) {
               if e.kind() == std::io::ErrorKind::UnexpectedEof {
                   // Handle EOF without the "0xFFFFFFFF 0x00000000"
                   // valid according to:
                   // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
                   self.finished = true;
                   Ok(None)
               } else {
                   Err(ArrowError::from(e))
   
               }
          } 
   }
   
   
   but the complier complain : 
   `expected `()`, found enum `std::result::Result`` 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] eyalleshem commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
eyalleshem commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r438898154



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       I don't think that i could remove return  , As it's not the last statement of the function .  
   
   for example i tried this : 
   
   ```
   if let Err(e) = self.reader.read_exact(&mut meta_size) {
               if e.kind() == std::io::ErrorKind::UnexpectedEof {
                   // Handle EOF without the "0xFFFFFFFF 0x00000000"
                   // valid according to:
                   // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
                   self.finished = true;
                   Ok(None)
               } else {
                   Err(ArrowError::from(e))
   
               }
          } 
   }
   ```
   
   but the complier complain : 
   `expected `()`, found enum `std::result::Result`` 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] eyalleshem commented on a change in pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
eyalleshem commented on a change in pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#discussion_r438898154



##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       I don't think that i could remove return  , As it's not the last statement of the function .  
   
   for example i tried this : 
   `if let Err(e) = self.reader.read_exact(&mut meta_size) {
               if e.kind() == std::io::ErrorKind::UnexpectedEof {
                   // Handle EOF without the "0xFFFFFFFF 0x00000000"
                   // valid according to:
                   // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
                   self.finished = true;
                   Ok(None)
               } else {
                   Err(ArrowError::from(e))
               }
           } `
   
   but the complier complain : 
   `expected `()`, found enum `std::result::Result`` 

##########
File path: rust/arrow/src/ipc/reader.rs
##########
@@ -793,7 +793,21 @@ impl<R: Read> StreamReader<R> {
         }
         // determine metadata length
         let mut meta_size: [u8; 4] = [0; 4];
-        self.reader.read_exact(&mut meta_size)?;
+
+        match self.reader.read_exact(&mut meta_size) {
+            Ok(()) => (),
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::UnexpectedEof {
+                    // Handle EOF without the "0xFFFFFFFF 0x00000000"
+                    // valid according to:
+                    // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
+                    self.finished = true;
+                    return Ok(None);
+                }
+                return Err(ArrowError::from(e));

Review comment:
       I don't think that i could remove return  , As it's not the last statement of the function .  
   
   for example i tried this : 
   `
   if let Err(e) = self.reader.read_exact(&mut meta_size) {
               if e.kind() == std::io::ErrorKind::UnexpectedEof {
                   // Handle EOF without the "0xFFFFFFFF 0x00000000"
                   // valid according to:
                   // https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
                   self.finished = true;
                   Ok(None)
               } else {
                   Err(ArrowError::from(e))
               }
           } 
   `
   
   but the complier complain : 
   `expected `()`, found enum `std::result::Result`` 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] nevi-me commented on pull request #7384: ARROW-9082: [Rust] - Stream reader fail when steam not ended with (opt…

Posted by GitBox <gi...@apache.org>.
nevi-me commented on pull request #7384:
URL: https://github.com/apache/arrow/pull/7384#issuecomment-642225601


   @maxburke may you please also look at this if you have a moment


----------------------------------------------------------------
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:
users@infra.apache.org