Skip to content

Commit f8a7322

Browse files
adriangbclaude
andcommitted
docs(physical-expr): a filter conjunct must return a boolean
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1e80253 commit f8a7322

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎datafusion/physical-expr/src/filter.rs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
//! that a consumer needs to decide how to apply it (for example, whether it
2424
//! is required for correctness).
2525
//!
26+
//! The expression of each conjunct must return a `Boolean` value. A row
27+
//! passes a conjunct only when the value is `true`: `false` and `NULL`
28+
//! remove the row. The type system does not enforce this rule. The code that
29+
//! makes a [`FilterConjunct`] must make sure that the expression is boolean.
30+
//!
2631
//! A [`PhysicalFilter`] is *not* a [`PhysicalExpr`]. Use
2732
//! [`PhysicalFilter::to_expr`] to get one expression (the `AND` of all
2833
//! conjuncts) for code that only accepts expressions.
@@ -41,6 +46,10 @@ use crate::utils::{conjunction, conjunction_opt, split_conjunction};
4146
/// consumer can skip an *optional* conjunct (for example, a dynamic filter
4247
/// from a hash join) without an effect on the result, because another
4348
/// operator removes the same rows again.
49+
///
50+
/// The expression must return a `Boolean` value. A row passes the conjunct
51+
/// only when the value is `true` (`NULL` removes the row, as `false` does).
52+
/// The constructors do not check the type. See the [module docs](self).
4453
#[derive(Debug, Clone)]
4554
pub struct FilterConjunct {
4655
expr: Arc<dyn PhysicalExpr>,
@@ -64,7 +73,7 @@ impl FilterConjunct {
6473
}
6574
}
6675

67-
/// The boolean expression of this conjunct.
76+
/// The expression of this conjunct. It returns a `Boolean` value.
6877
pub fn expr(&self) -> &Arc<dyn PhysicalExpr> {
6978
&self.expr
7079
}

0 commit comments

Comments
 (0)