jayzhan211 commented on issue #11212: URL: https://github.com/apache/datafusion/issues/11212#issuecomment-2205933735
> > I'm not sure if modifying and / or kleene logic help, since it needs two boolean array, but in this case we expect to short circuit if the left hand side has boolean array with all false for AND clause. > > In the kernel we can add a fast case as well, just as @acking-you has done in his [code](https://github.com/apache/datafusion/pull/11247/files) . The benefit of this is that it will apply for any place that uses `and`/ `and_kleene`/`or`/`or_kleene` rather than in `BinaryExpr` alone. I agree that we can also optimize the kleene kernel, so we can early return the result. But besides that we also need to find a way to avoid computation in datafusion. Current code is like ```rust let left: BooleanArray = expr.evalute() let right: BooleanArray = expr.evalute() let result = and_kleene(left, right) // we can optimize this too! ``` But ideally we could avoid computation of `right` ```rust let left: BooleanArray = expr.evalute() // left is always false skip right evaluation // right evaluation is possible to be expensive skip and_kleene ``` #11247 indeed did a good job, but it seems like a specialize hacking code, not sure if it is the best solution 🤔 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org