Skip to content

Commit a3b34b2

Browse files
committed
fix: ensure arrow reader returns Unsupported when delete files present in a file scan task
1 parent 274cc55 commit a3b34b2

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

crates/iceberg/src/arrow/reader.rs

+8
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ impl ArrowReader {
167167
row_group_filtering_enabled: bool,
168168
row_selection_enabled: bool,
169169
) -> Result<ArrowRecordBatchStream> {
170+
// TODO: add support for delete files
171+
if !task.deletes.is_empty() {
172+
return Err(Error::new(
173+
ErrorKind::FeatureUnsupported,
174+
"Delete files are not yet supported",
175+
));
176+
}
177+
170178
// Get the metadata for the Parquet file we need to read and build
171179
// a reader for the data within
172180
let parquet_file = file_io.new_input(&task.data_file_path)?;

crates/integration_tests/tests/read_positional_deletes.rs

+20-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
//! Integration tests for rest catalog.
1919
20+
use futures::TryStreamExt;
2021
use iceberg::ErrorKind::FeatureUnsupported;
2122
use iceberg::{Catalog, TableIdent};
2223
use iceberg_integration_tests::set_test_fixture;
@@ -35,16 +36,31 @@ async fn test_read_table_with_positional_deletes() {
3536
.await
3637
.unwrap();
3738

38-
let scan = table.scan().build().unwrap();
39+
let scan = table
40+
.scan()
41+
.with_delete_file_processing_enabled(true)
42+
.build()
43+
.unwrap();
3944
println!("{:?}", scan);
4045

41-
assert!(scan
42-
.to_arrow()
46+
let plan: Vec<_> = scan
47+
.plan_files()
48+
.await
49+
.unwrap()
50+
.try_collect()
4351
.await
44-
.is_err_and(|e| e.kind() == FeatureUnsupported));
52+
.unwrap();
53+
println!("{:?}", plan);
54+
55+
// Scan plan phase should include delete files in file plan
56+
// when with_delete_file_processing_enabled == true
57+
assert_eq!(plan[0].deletes.len(), 2);
4558

4659
// 😱 If we don't support positional deletes, we should fail when we try to read a table that
4760
// has positional deletes. The table has 12 rows, and 2 are deleted, see provision.py
61+
let result = scan.to_arrow().await.unwrap().try_collect::<Vec<_>>().await;
62+
63+
assert!(result.is_err_and(|e| e.kind() == FeatureUnsupported));
4864

4965
// When we get support for it:
5066
// let batch_stream = scan.to_arrow().await.unwrap();

0 commit comments

Comments
 (0)