apache / apache/datafusion

Eliminate Unsatisfiable Boolean Expressions

Open
#1,716 10 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**

I noticed Datafusion is not able to simplify the expression

```
A ^ !A
```

Whilst it is unlikely for a user to write such an expression, it is not uncommon for boolean expressions to reduce to something unsatisfiable. Where this is the case, substituting in `false` may allow for further simplification.

**Describe the solution you'd like**

It would be awesome if Datafusion was able to detect and eliminate unsatisfiable boolean expressions. I believe this is an NP-hard problem in the general case, but should be tractable for a low number of variables.

Contributor guide

Open the contributing guide

Research direction

The issue does not name specific files or tests; first locate DataFusion's boolean-expression simplification entry point and trace how `A ^ !A` is handled. Check the existing simplification tests, then define how unsatisfiable expressions should be detected and replaced with `false`, including the expected behavior for a small number of variables.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.