Skip to content

Commit 5bdb937

Browse files
ZENOTMEZENOTMEFokkoliurenjie1024
authored
feat: support strict projection (#946)
This PR is part of #735. The implementation refers pyiceberg. Most of the code is test migrate from: https://github.com/apache/iceberg-python/blob/main/tests/test_transforms.py#L997 --------- Co-authored-by: ZENOTME <st810918843@gmail.com> Co-authored-by: Fokko Driesprong <fokko@apache.org> Co-authored-by: Renjie Liu <liurenjie2008@gmail.com>
1 parent 2bc5dca commit 5bdb937

File tree

4 files changed

+3562
-14
lines changed

4 files changed

+3562
-14
lines changed

crates/iceberg/src/expr/visitors/inclusive_projection.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use fnv::FnvHashSet;
2222
use crate::expr::visitors::bound_predicate_visitor::{visit, BoundPredicateVisitor};
2323
use crate::expr::{BoundPredicate, BoundReference, Predicate};
2424
use crate::spec::{Datum, PartitionField, PartitionSpecRef};
25-
use crate::Error;
25+
use crate::{Error, ErrorKind};
2626

2727
pub(crate) struct InclusiveProjection {
2828
partition_spec: PartitionSpecRef,
@@ -102,7 +102,11 @@ impl BoundPredicateVisitor for InclusiveProjection {
102102
}
103103

104104
fn not(&mut self, _inner: Self::T) -> crate::Result<Self::T> {
105-
panic!("InclusiveProjection should not be performed against Predicates that contain a Not operator. Ensure that \"Rewrite Not\" gets applied to the originating Predicate before binding it.")
105+
Err(
106+
Error::new(
107+
ErrorKind::Unexpected,
108+
"InclusiveProjection should not be performed against Predicates that contain a Not operator. Ensure that \"Rewrite Not\" gets applied to the originating Predicate before binding it.", )
109+
)
106110
}
107111

108112
fn is_null(

crates/iceberg/src/expr/visitors/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ pub(crate) mod manifest_evaluator;
2323
pub(crate) mod page_index_evaluator;
2424
pub(crate) mod row_group_metrics_evaluator;
2525
pub(crate) mod strict_metrics_evaluator;
26+
pub(crate) mod strict_projection;

0 commit comments

Comments
 (0)