From b4e4f5a8a7e85dd8645b3c264d9ab21ed30271d2 Mon Sep 17 00:00:00 2001 From: Joe Isaacs Date: Mon, 20 Jan 2025 20:17:43 +0000 Subject: [PATCH] Return empty conjunct list if filter is true (#2027) --- vortex-expr/src/forms/cnf.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vortex-expr/src/forms/cnf.rs b/vortex-expr/src/forms/cnf.rs index 062b779686..8f3500ed99 100644 --- a/vortex-expr/src/forms/cnf.rs +++ b/vortex-expr/src/forms/cnf.rs @@ -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). /// @@ -143,6 +143,10 @@ use crate::{BinaryExpr, ExprRef, Operator}; /// ``` /// pub fn cnf(expr: ExprRef) -> VortexResult>> { + if expr == lit(true) { + // True in CNF + return Ok(vec![]); + } let nnf = nnf(expr)?; let mut visitor = CNFVisitor::default();