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/02/28 20:36:01 UTC

[GitHub] [arrow-rs] alamb commented on a change in pull request #1346: Remove existing has_ methods for optional fields

alamb commented on a change in pull request #1346:
URL: https://github.com/apache/arrow-rs/pull/1346#discussion_r816231295



##########
File path: parquet/src/file/metadata.rs
##########
@@ -428,32 +428,21 @@ impl ColumnChunkMetaData {
         self.data_page_offset
     }
 
-    /// Returns `true` if this column chunk contains a index page, `false` otherwise.
-    pub fn has_index_page(&self) -> bool {
-        self.index_page_offset.is_some()
-    }
-
     /// Returns the offset for the index page.
     pub fn index_page_offset(&self) -> Option<i64> {
         self.index_page_offset
     }
 
-    /// Returns `true` if this column chunk contains a dictionary page, `false` otherwise.
-    pub fn has_dictionary_page(&self) -> bool {
-        self.dictionary_page_offset.is_some()
-    }
-
     /// Returns the offset for the dictionary page, if any.
     pub fn dictionary_page_offset(&self) -> Option<i64> {
         self.dictionary_page_offset
     }
 
     /// Returns the offset and length in bytes of the column chunk within the file
     pub fn byte_range(&self) -> (u64, u64) {
-        let col_start = if self.has_dictionary_page() {
-            self.dictionary_page_offset().unwrap()
-        } else {
-            self.data_page_offset()
+        let col_start = match self.dictionary_page_offset() {

Review comment:
       I don't think it matters at all, but just FYI you can also write this code like
   
   ```rust
   let col_start = self.dictionary_page_offset()
     .unwrap_or(self.data_page_offset())
   ```
   
   Which some might argue is more 'idomatic' rust




-- 
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