Skip to content

Commit

Permalink
feat: Project transform (apache#309)
Browse files Browse the repository at this point in the history
* add project bucket_unary

* add project bucket_binary

* add project bucket_set

* add project identity

* add project truncate

* fixed array boundary

* add project void

* add project unknown

* add docs + none projections

* docs

* docs

* remove trait + impl boundary on Datum

* fix: clippy

* fix: test Transform::Unknown

* add: transform_literal_result

* add: transform_literal_result

* remove: whitespace

* move `boundary` to transform.rs

* add check if transform can be applied to data_type

* add check

* add: java-testsuite Transform::Bucket

* fix: clippy

* add: timestamps to boundary

* change: return bool from can_transform

* fix: clippy

* refactor: fn project match structure

* add: java-testsuite Transform::Truncate

* add: java-testsuite Transform::Dates + refactor

* fix: doc

* add: timestamp test + refactor

* refactor: simplify projected_boundary

* add: java-testsuite Transform::Timestamp

* refactor tests

* fix: timestamp conversion

* fix: temporal test_result

* basic fix

* change to Result<i32>

* use try_unary

* add: java-testsuite Transform::Timestamp Hours

* refactor: split and move tests

* refactor: move transform tests

* remove self

* refactor: structure fn project + helpers

* fix: clippy

* fix: typo

* fix: naming + generics
  • Loading branch information
marvinlanhenke authored and shaeqahmed committed Dec 9, 2024
1 parent 6085fd4 commit 41f93ee
Show file tree
Hide file tree
Showing 8 changed files with 3,633 additions and 508 deletions.
15 changes: 15 additions & 0 deletions crates/iceberg/src/expr/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ impl<T> UnaryExpression<T> {
debug_assert!(op.is_unary());
Self { op, term }
}
pub(crate) fn op(&self) -> PredicateOperator {
self.op
}
}

/// Binary predicate, for example, `a > 10`.
Expand Down Expand Up @@ -144,6 +147,12 @@ impl<T> BinaryExpression<T> {
debug_assert!(op.is_binary());
Self { op, term, literal }
}
pub(crate) fn op(&self) -> PredicateOperator {
self.op
}
pub(crate) fn literal(&self) -> &Datum {
&self.literal
}
}

impl<T: Display> Display for BinaryExpression<T> {
Expand Down Expand Up @@ -191,6 +200,12 @@ impl<T> SetExpression<T> {
debug_assert!(op.is_set());
Self { op, term, literals }
}
pub(crate) fn op(&self) -> PredicateOperator {
self.op
}
pub(crate) fn literals(&self) -> &FnvHashSet<Datum> {
&self.literals
}
}

impl<T: Bind> Bind for SetExpression<T> {
Expand Down
Loading

0 comments on commit 41f93ee

Please sign in to comment.