alamb commented on code in PR #8817:
URL: https://github.com/apache/arrow-rs/pull/8817#discussion_r2516014843


##########
parquet/src/file/writer.rs:
##########
@@ -2442,4 +2443,74 @@ mod tests {
             start += 1;
         }
     }
+
+    #[test]
+    fn test_rewrite_no_page_indexes() {
+        let file = get_test_file("alltypes_tiny_pages.parquet");
+        let metadata = ParquetMetaDataReader::new()
+            .with_page_index_policy(PageIndexPolicy::Optional)
+            .parse_and_finish(&file)
+            .unwrap();
+
+        let props = Arc::new(WriterProperties::builder().build());
+        let schema = metadata.file_metadata().schema_descr().root_schema_ptr();
+        let output = Vec::<u8>::new();
+        let mut writer = SerializedFileWriter::new(output, schema, 
props).unwrap();
+
+        for rg in metadata.row_groups() {
+            let mut rg_out = writer.next_row_group().unwrap();
+            for column in rg.columns() {
+                let result = ColumnCloseResult {
+                    bytes_written: column.compressed_size() as _,
+                    rows_written: rg.num_rows() as _,
+                    metadata: column.clone(),
+                    bloom_filter: None,
+                    column_index: None,
+                    offset_index: None,
+                };
+                rg_out.append_column(&file, result).unwrap();
+            }
+            rg_out.close().unwrap();
+        }
+        writer.close().unwrap();
+    }
+
+    #[test]
+    fn test_rewrite_missing_column_index() {

Review Comment:
   FWIW I also verified that this test covers the change by runing it without 
this PR and it fails as expected:
   
   ```
   ---- file::writer::tests::test_rewrite_no_page_indexes stdout ----
   
   thread 'file::writer::tests::test_rewrite_no_page_indexes' (25670053) 
panicked at parquet/src/file/metadata/writer.rs:243:54:
   called `Option::unwrap()` on a `None` value
   
   ---- file::writer::tests::test_rewrite_missing_column_index stdout ----
   
   thread 'file::writer::tests::test_rewrite_missing_column_index' (25670052) 
panicked at parquet/src/file/writer.rs:2514:24:
   called `Result::unwrap()` on an `Err` value: General("Cannot serialize NONE 
index")
   
   
   failures:
       file::writer::tests::test_rewrite_missing_column_index
       file::writer::tests::test_rewrite_no_page_indexes
   
   test result: FAILED. 815 passed; 2 failed; 0 ignored; 0 measured; 0 filtered 
out; finished in 3.49s
   ```



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