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

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   **To Reproduce**
   
   ```rs
       #[tokio::test]
       async fn test_async_writer_to_file() {
           let col = Arc::new(Int64Array::from_iter_values([1, 2, 3])) as 
ArrayRef;
           // this column with random large strings will cause corruption of 
footer
           let col2 = 
Arc::new(StringArray::from(vec![generate_random_string(500000), 
generate_random_string(500000), generate_random_string(500000)])) as ArrayRef;
           // but this will work (column size is smaller)
           // let col2 = 
Arc::new(StringArray::from(vec![generate_random_string(50000), 
generate_random_string(50000), generate_random_string(50000)])) as ArrayRef;
           let to_write = RecordBatch::try_from_iter([("col", col), ("col2", 
col2)]).unwrap();
   
           let file = 
tokio::fs::File::create("/path/to/file/test.parquet").await.unwrap();
           let mut writer =
               AsyncArrowWriter::try_new(file, to_write.schema(), 0, 
None).unwrap();
           writer.write(&to_write).await.unwrap();
           writer.close().await.unwrap();
   
           let file = 
std::fs::File::open("/path/to/file/test.parquet").unwrap();
           let mut reader = ParquetRecordBatchReaderBuilder::try_new(file)
               .unwrap()
               .build()
               .unwrap();
           let read = reader.next().unwrap().unwrap();
   
           assert_eq!(to_write, read);
       }
       
       fn generate_random_string(length: usize) -> String {
           thread_rng()
               .sample_iter(&Alphanumeric)
               .take(length)
               .map(char::from)
               .collect()
       }
   ```
   
   Reader fails with:
   ```
   called `Result::unwrap()` on an `Err` value: General("Invalid Parquet file. 
Corrupt footer")
   ```
   
   That's definitely something with writer, because I've tested other tools 
(e.g `parquet-fromcsv`) and the same files were written well. In addition, 
looks like sync writer also works fine.
   
   **Expected behavior**
   The output file shouldn't be corrupted
   
   **Additional context**
   <!--
   Add any other context about the problem 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