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

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   There are several cases where we would like to have more control over the 
encoding/deocing of Parquet metadata:
   1. serialize and deserialize it outside of a parquet file so I can store it 
in a cache outside of parquet files and avoid slow object store requests 
(https://github.com/apache/arrow-rs/discussions/5988)
   2. https://github.com/apache/arrow-rs/issues/5855
   3. https://github.com/apache/arrow-rs/issues/5999
   4. Ensuring that the Page index structures are read properly requires 
setting some non obvious settings on the reader scuh as 
[ArrowReaderOptions::with_page_index](https://docs.rs/parquet/latest/parquet/arrow/arrow_reader/struct.ArrowReaderOptions.html#method.with_page_index)
   
   At the time of writing, the current APIs exposed
   1. No API exposed for creating / writing parquet metadata
   2. The API exposed for reading parquet metadata, 
[`decode_metadata`](https://docs.rs/parquet/latest/parquet/file/footer/fn.decode_metadata.html),
 has no way for finer grained control
   
   **Describe the solution you'd like**
   I would like an API that allows more fine grained control over 
reading/writing metadata and that permits adding additional features over time 
in a backwards compatible way
   
   
   **Describe alternatives you've considered**
   
   Here is one potential idea -- to create `Encoder` / `Decoder` structs that 
can encode and decode the metadata along with various configuration options. 
   
   ```rust
   let encoder = ParquetMetadataEncoder::new()
      .with_some_options(foo);
   let mut buffer = vec![]
   encoder.encode(metadata, &mut buffer)
   ```
   
   Similarly for decoding
   ```rust
   let decoder = ParquetMetadataDecoder::new()
      .with_offset_index(true)
      .with_column_index(true);
   
   let result = decoder.decode(&buffer);
   // decoder need to have some way to communicate
   // if it doesn't have sufficient information (e.g the PageIndex 
   // wasn't present). Maybe this should just be an error?
   match result {
     FullDecode(metadata) => return metadata,
     NeedMoreData(range) => {
       // fetch additional data and pass to deocder?
       todo!()
     } 
     ..
   };
   ```
   
   **Additional context**
   This ticket is based on the discussion with @adriangb here 
https://github.com/apache/arrow-rs/discussions/5988
   
   There are a bunch of discussions on metadata speed here 
https://github.com/apache/arrow-rs/issues/5770
   
   Here is a PR with a proposed 'encode_metadata' function: 
https://github.com/apache/arrow-rs/pull/6000


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