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 2022/10/26 10:19:28 UTC

[GitHub] [arrow-rs] waitingkuo commented on a diff in pull request #2928: Improve panic messages for RowSelection::and_then (#2925)

waitingkuo commented on code in PR #2928:
URL: https://github.com/apache/arrow-rs/pull/2928#discussion_r1005497354


##########
parquet/src/arrow/arrow_reader/selection.rs:
##########
@@ -223,17 +223,26 @@ impl RowSelection {
     /// returned: NNNNNNNNNNNNYYYYYNNNNYYYYYYYYYYYYYNNNYYNNN
     ///
     ///
+    /// # Panics
+    ///
+    /// Panics if `other` does not have a length equal to the number of rows selected
+    /// by this RowSelection
+    ///
     pub fn and_then(&self, other: &Self) -> Self {
         let mut selectors = vec![];
         let mut first = self.selectors.iter().cloned().peekable();
         let mut second = other.selectors.iter().cloned().peekable();
 
         let mut to_skip = 0;
         while let Some(b) = second.peek_mut() {
-            let a = first.peek_mut().unwrap();
+            let a = first
+                .peek_mut()
+                .expect("selection exceeds the number of selected rows");

Review Comment:
   👍 



-- 
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: github-unsubscribe@arrow.apache.org

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