You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/06/05 13:29:58 UTC

[GitHub] [arrow-rs] tustvold commented on issue #4365: List-of-String Array panics in the presence of row filters

tustvold commented on issue #4365:
URL: https://github.com/apache/arrow-rs/issues/4365#issuecomment-1576812180

   Thank you for the report, yes I would expect this to work correctly
   
   A reduced example:
   
   ```
   use arrow::array::{ListBuilder, StringBuilder};
   use arrow::datatypes::{DataType, Field, Schema};
   use arrow::record_batch::RecordBatch;
   use std::sync::Arc;
   
   use bytes::Bytes;
   use parquet::arrow::arrow_reader::{
       ParquetRecordBatchReaderBuilder, RowSelection, RowSelector,
   };
   use parquet::arrow::ArrowWriter;
   use parquet::file::properties::WriterProperties;
   use std::error::Error;
   
   fn main() -> Result<(), Box<dyn Error>> {
       let schema = Arc::new(Schema::new(vec![Field::new_list(
           "list",
           Field::new("item", DataType::Utf8, true),
           false,
       )]));
       let mut buf = Vec::with_capacity(1024);
   
       let mut writer = ArrowWriter::try_new(
           &mut buf,
           schema.clone(),
           Some(WriterProperties::builder().build()),
       )?;
       for _ in 0..2 {
           let mut list_a_builder = ListBuilder::new(StringBuilder::new());
           for i in 0..1024 {
               list_a_builder.values().append_value(format!("{i}"));
               list_a_builder.append(true);
           }
           let batch = RecordBatch::try_new(
               schema.clone(),
               vec![Arc::new(list_a_builder.finish())],
           )?;
           writer.write(&batch)?;
       }
       let _metadata = writer.close()?;
   
       let buf = Bytes::from(buf);
       let reader = ParquetRecordBatchReaderBuilder::try_new(buf)
           .unwrap()
           .with_row_selection(RowSelection::from(vec![
               RowSelector::skip(100),
               RowSelector::select(924),
               RowSelector::skip(100),
               RowSelector::select(924),
           ]))
           .build()
           .unwrap();
   
       let total_rows: usize = reader.map(|r| r.unwrap().num_rows()).sum();
       assert_eq!(total_rows, 924 * 2);
   
       Ok(())
   }
   ```
   
   It also does not seem to be specific to lists of strings.
   
   I will continue digging
   
   
   


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