mbutrovich commented on code in PR #3302:
URL: https://github.com/apache/iceberg-rust/pull/3302#discussion_r4298009899
##########
crates/iceberg/src/scan/mod.rs:
##########
@@ -3109,4 +3120,145 @@ mod tests {
.collect();
assert_eq!(y, (1100..1200).collect::<Vec<i64>>());
}
+
+ /// Appends one data file holding `columns`, written with the table's
current schema.
+ async fn append_data_file(
+ catalog: &impl Catalog,
+ table: Table,
+ columns: Vec<ArrayRef>,
+ ) -> Table {
+ let schema = table.metadata().current_schema().clone();
+ let batch =
+
RecordBatch::try_new(Arc::new(schema_to_arrow_schema(&schema).unwrap()),
columns)
+ .unwrap();
+ let rolling_file_writer_builder =
RollingFileWriterBuilder::new_with_default_file_size(
+ ParquetWriterBuilder::new(WriterProperties::default(), schema),
+ table.file_io().clone(),
+ DefaultLocationGenerator::new(table.metadata()).unwrap(),
+ DefaultFileNameGenerator::new(
+ Uuid::new_v4().to_string(),
+ None,
+ DataFileFormat::Parquet,
+ ),
+ );
+ let mut writer =
DataFileWriterBuilder::new(rolling_file_writer_builder)
+ .build(None)
+ .await
+ .unwrap();
+ writer.write(batch).await.unwrap();
+ let data_files = writer.close().await.unwrap();
+
+ let tx = Transaction::new(&table);
+ let tx = tx
+ .fast_append()
+ .add_data_files(data_files)
+ .apply(tx)
+ .unwrap();
+ tx.commit(catalog).await.unwrap()
+ }
+
+ /// Mirrors Java's
`TestFilterPushDown.testFilterPushdownOnInitialDefaultColumnAbsentFromFile`.
+ /// The first file is written before `c` is added with `initial-default`
'US', so its row
+ /// reads `c` as 'US'. The second file stores `c`.
+ #[tokio::test]
+ async fn test_scan_filter_on_initial_default_column_absent_from_file() {
Review Comment:
> Consider trimming it to one or two predicates, or dropping it and keeping
the Java mirror in the reader test.
I trimmed it to `c = 'US'` and `c IS NULL` with row selection off. I kept it
because it is the only test that goes through `update_schema` and `TableScan`.
Its doc now points to the reader tests for the other predicates and for row
selection.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]