Skip to content

Commit 29185c0

Browse files
committed
suppport more datafusion predict
1 parent 1533c43 commit 29185c0

File tree

4 files changed

+281
-225
lines changed

4 files changed

+281
-225
lines changed

crates/iceberg/src/expr/predicate.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,16 @@ impl<T: Bind> Bind for UnaryExpression<T> {
132132
}
133133

134134
impl<T> UnaryExpression<T> {
135-
pub(crate) fn new(op: PredicateOperator, term: T) -> Self {
135+
/// Creates a unary expression with the given operator and term.
136+
///
137+
/// # Example
138+
///
139+
/// ```rust
140+
/// use iceberg::expr::{PredicateOperator, Reference, UnaryExpression};
141+
///
142+
/// UnaryExpression::new(PredicateOperator::IsNull, Reference::new("c"));
143+
/// ```
144+
pub fn new(op: PredicateOperator, term: T) -> Self {
136145
debug_assert!(op.is_unary());
137146
Self { op, term }
138147
}
@@ -171,7 +180,21 @@ impl<T: Debug> Debug for BinaryExpression<T> {
171180
}
172181

173182
impl<T> BinaryExpression<T> {
174-
pub(crate) fn new(op: PredicateOperator, term: T, literal: Datum) -> Self {
183+
/// Creates a binary expression with the given operator, term and literal.
184+
///
185+
/// # Example
186+
///
187+
/// ```rust
188+
/// use iceberg::expr::{BinaryExpression, PredicateOperator, Reference};
189+
/// use iceberg::spec::Datum;
190+
///
191+
/// BinaryExpression::new(
192+
/// PredicateOperator::LessThanOrEq,
193+
/// Reference::new("a"),
194+
/// Datum::int(10),
195+
/// );
196+
/// ```
197+
pub fn new(op: PredicateOperator, term: T, literal: Datum) -> Self {
175198
debug_assert!(op.is_binary());
176199
Self { op, term, literal }
177200
}

0 commit comments

Comments
 (0)