pub enum Predicate {
Comparison {
column: String,
op: ComparisonOp,
value: ScalarValue,
},
IsNull {
column: String,
},
IsNotNull {
column: String,
},
And(Vec<Predicate>),
Or(Vec<Predicate>),
Not(Box<Predicate>),
}Expand description
A predicate that can be evaluated against row group statistics
Predicates are simplified expressions used for filtering row groups before decoding. They support basic comparison operations, NULL checks, and logical combinations (AND, OR, NOT).
§Example
use orc_rust::predicate::{Predicate, ComparisonOp, PredicateValue};
// Create a predicate: age >= 18
let predicate = Predicate::gte("age", PredicateValue::Int32(Some(18)));
// Create a compound predicate: age >= 18 AND city = 'NYC'
let predicate = Predicate::and(vec![
Predicate::gte("age", PredicateValue::Int32(Some(18))),
Predicate::eq("city", PredicateValue::Utf8(Some("NYC".to_string()))),
]);Variants§
Comparison
Column comparison: column
IsNull
IS NULL check
IsNotNull
IS NOT NULL check
And(Vec<Predicate>)
Logical AND of predicates
Or(Vec<Predicate>)
Logical OR of predicates
Not(Box<Predicate>)
Logical NOT
Implementations§
Source§impl Predicate
impl Predicate
Sourcepub fn comparison(column: &str, op: ComparisonOp, value: ScalarValue) -> Self
pub fn comparison(column: &str, op: ComparisonOp, value: ScalarValue) -> Self
Create a comparison predicate: column
Sourcepub fn eq(column: &str, value: ScalarValue) -> Self
pub fn eq(column: &str, value: ScalarValue) -> Self
Create a predicate for column == value
Sourcepub fn ne(column: &str, value: ScalarValue) -> Self
pub fn ne(column: &str, value: ScalarValue) -> Self
Create a predicate for column != value
Sourcepub fn lt(column: &str, value: ScalarValue) -> Self
pub fn lt(column: &str, value: ScalarValue) -> Self
Create a predicate for column < value
Sourcepub fn lte(column: &str, value: ScalarValue) -> Self
pub fn lte(column: &str, value: ScalarValue) -> Self
Create a predicate for column <= value
Sourcepub fn gt(column: &str, value: ScalarValue) -> Self
pub fn gt(column: &str, value: ScalarValue) -> Self
Create a predicate for column > value
Sourcepub fn gte(column: &str, value: ScalarValue) -> Self
pub fn gte(column: &str, value: ScalarValue) -> Self
Create a predicate for column >= value
Sourcepub fn is_not_null(column: &str) -> Self
pub fn is_not_null(column: &str) -> Self
Create a predicate for column IS NOT NULL
Trait Implementations§
impl StructuralPartialEq for Predicate
Auto Trait Implementations§
impl Freeze for Predicate
impl RefUnwindSafe for Predicate
impl Send for Predicate
impl Sync for Predicate
impl Unpin for Predicate
impl UnwindSafe for Predicate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more