Skip to content

Commit 2732a49

Browse files
committed
refactor: minor cleanup
1 parent 28021a4 commit 2732a49

File tree

3 files changed

+24
-33
lines changed

3 files changed

+24
-33
lines changed

crates/iceberg/src/arrow/reader.rs

+21-12
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,27 @@ impl ArrowReader {
283283
fn get_equality_deletes(_delete_files: &[Deletes]) -> Result<Option<BoundPredicate>> {
284284
let result = None;
285285

286-
// TODO:
287-
// reject DeleteFiles that are not equality deletes
288-
// * for each delete file:
289-
// * set `file_predicate` = AlwaysTrue
290-
// * for each row in the file:
291-
// * for each cell in the row:
292-
// * create a predicate of the form `field` = `val`
293-
// where `field` is the column name and `val` is the value
294-
// of the cell
295-
// * Bind this predicate to the table schema to get a `BoundPredicate`
296-
// * set file_predicate = file_predicate.and(bound_predicate_for_cell)
297-
// * set result = result.or(file_predicate)
286+
for delete_file in _delete_files {
287+
let Deletes::Equality(_delete_file_batches) = delete_file else {
288+
continue;
289+
};
290+
291+
return Err(Error::new(
292+
ErrorKind::FeatureUnsupported,
293+
"Equality delete files are not yet supported.",
294+
));
295+
296+
// TODO:
297+
// * set `file_predicate` = AlwaysTrue
298+
// * for each row in the file:
299+
// * for each cell in the row:
300+
// * create a predicate of the form `field` = `val`
301+
// where `field` is the column name and `val` is the value
302+
// of the cell
303+
// * Bind this predicate to the table schema to get a `BoundPredicate`
304+
// * set file_predicate = file_predicate.and(bound_predicate_for_cell)
305+
// * set result = result.or(file_predicate)
306+
}
298307

299308
Ok(result)
300309
}

crates/iceberg/src/scan.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -572,35 +572,19 @@ impl TableScan {
572572
}
573573

574574
if let Some(ref bound_predicates) = manifest_entry_context.bound_predicates {
575-
let BoundPredicates {
576-
// ref snapshot_bound_predicate,
577-
ref partition_bound_predicate,
578-
..
579-
} = bound_predicates.as_ref();
580-
581575
let expression_evaluator_cache =
582576
manifest_entry_context.expression_evaluator_cache.as_ref();
583577

584578
let expression_evaluator = expression_evaluator_cache.get(
585579
manifest_entry_context.partition_spec_id,
586-
partition_bound_predicate,
580+
&bound_predicates.partition_bound_predicate,
587581
)?;
588582

589583
// skip any data file whose partition data indicates that it can't contain
590584
// any data that matches this scan's filter
591585
if !expression_evaluator.eval(manifest_entry_context.manifest_entry.data_file())? {
592586
return Ok(());
593587
}
594-
595-
// TODO: I don't think that this is required. Need to confirm
596-
// skip any data file whose metrics don't match this scan's filter
597-
// if !InclusiveMetricsEvaluator::eval(
598-
// snapshot_bound_predicate,
599-
// manifest_entry_context.manifest_entry.data_file(),
600-
// false,
601-
// )? {
602-
// return Ok(());
603-
// }
604588
}
605589

606590
file_scan_task_delete_file_tx

crates/iceberg/src/spec/delete_file.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ use crate::{Error, ErrorKind, Result};
2828

2929
pub(crate) const FIELD_ID_DELETE_FILE_PATH: i32 = i32::MAX - 101;
3030
pub(crate) const FIELD_ID_DELETE_POS: i32 = i32::MAX - 102;
31-
// pub(crate) const FIELD_ID_DELETE_ROW: i32 = i32::MAX - 103;
3231

3332
pub(crate) const FIELD_NAME_DELETE_FILE_PATH: &str = "file_path";
3433
pub(crate) const FIELD_NAME_DELETE_POS: &str = "pos";
35-
// pub(crate) const FIELD_NAME_DELETE_ROW: &str = "row";
3634

3735
// Represents a parsed Delete file that can be safely stored
3836
// in the Object Cache.
@@ -111,8 +109,8 @@ fn validate_schema(schema: SchemaRef) -> Result<PosDelSchema> {
111109
} else if fields.len() == 2 {
112110
Ok(PosDelSchema::WithoutRow)
113111
} else {
114-
// TODO: should check that col 3 is of type Struct
115-
// and that it contains a subset of the table schema
112+
// TODO: should we check that col 3 is of type Struct
113+
// and that it contains a subset of the table schema?
116114
Ok(PosDelSchema::WithRow)
117115
}
118116
}

0 commit comments

Comments
 (0)