Skip to content

Commit

Permalink
Return empty conjunct list if filter is true (#2027)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-isaacs authored Jan 20, 2025
1 parent 452b02b commit b4e4f5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vortex-expr/src/forms/cnf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use vortex_error::VortexResult;

use super::nnf::nnf;
use crate::traversal::{Node as _, NodeVisitor, TraversalOrder};
use crate::{BinaryExpr, ExprRef, Operator};
use crate::{lit, BinaryExpr, ExprRef, Operator};

/// Return an equivalent expression in Conjunctive Normal Form (CNF).
///
Expand Down Expand Up @@ -143,6 +143,10 @@ use crate::{BinaryExpr, ExprRef, Operator};
/// ```
///
pub fn cnf(expr: ExprRef) -> VortexResult<Vec<Vec<ExprRef>>> {
if expr == lit(true) {
// True in CNF
return Ok(vec![]);
}
let nnf = nnf(expr)?;

let mut visitor = CNFVisitor::default();
Expand Down

0 comments on commit b4e4f5a

Please sign in to comment.