Skip to content

Enhance partition pruning to support NOT BETWEEN and NOT IN expressions #123

@alxmrs

Description

@alxmrs

Background

In src/lib.rs, between_excludes and in_list_excludes return false immediately for negated forms:

// NOT BETWEEN is complex, be conservative
if between.negated { return false; }

// NOT IN is complex, be conservative
if in_list.negated { return false; }

The current conservative behavior (never prune) is always safe. These are opportunities to prune more aggressively.

NOT BETWEEN

NOT BETWEEN low AND high is equivalent to col < low OR col > high.

A partition [min, max] can be excluded if it falls entirely within [low, high] — i.e., min >= low AND max <= high. In that case ALL rows satisfy col BETWEEN low AND high, so NONE satisfy NOT BETWEEN.

NOT IN

A simpler conservative improvement: if the partition has a single point (min == max) and that exact value appears in the NOT IN list, the partition can be pruned.

Notes

  • These are enhancements and are not critical for correctness — the current behavior is always safe.
  • Implement after the Expr::Not bug is confirmed fixed and covered by tests (see issue about IN-list and NOT filter test coverage).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions