mapleFU opened a new issue, #6255:
URL: https://github.com/apache/arrow-rs/issues/6255

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   <!--
   A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for 
this feature, in addition to  the *what*)
   -->
   
   See: 
https://github.com/apache/parquet-testing/pull/58#issuecomment-2290985490
   
   When reading a corrupt file, currently, arrow-rs would have:
   
   ```rust
       /// Returns the offset and length in bytes of the column chunk within 
the file
       pub fn byte_range(&self) -> (u64, u64) {
           let col_start = match self.dictionary_page_offset() {
               Some(dictionary_page_offset) => dictionary_page_offset,
               None => self.data_page_offset(),
           };
           let col_len = self.compressed_size();
           assert!(
               col_start >= 0 && col_len >= 0,
               "column start and length should not be negative"
           );
           (col_start as u64, col_len as u64)
       }
   ```
   
   Would we better check the range here?
   
   **Describe the solution you'd like**
   <!--
   A clear and concise description of what you want to happen.
   -->
   
   Checking the range when building the group reader or in "byte_range()"
   
   **Describe alternatives you've considered**
   <!--
   A clear and concise description of any alternative solutions or features 
you've considered.
   -->
   
   ```rust
       /// Returns the offset and length in bytes of the column chunk within 
the file
       pub fn byte_range(&self) -> Result<(u64, u64)> {
           let col_start = match self.dictionary_page_offset() {
               Some(dictionary_page_offset) => dictionary_page_offset,
               None => self.data_page_offset(),
           };
           let col_len = self.compressed_size();
           if col_len < 0 || col_len < 0{
               return Err(ParquetError::General(
                   "column start and length should not be negative".to_string(),
               ));
           }
           (col_start as u64, col_len as u64)
       }
   ```
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request here.
   -->
   


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

Reply via email to