Skip to content

Add stats rewrite pruning for LIKE predicates #7941

Open

Description

@gatesn

Summary

Add stats rewrite rules that can falsify simple LIKE predicates using ordered string bounds, such as exact strings and anchored prefixes.

Context

While porting existing stats pruning behavior to the aggregate-backed stats rewrite registry, we found a LIKE rewrite that would be new behavior relative to develop. That should be handled separately from the current stats rewrite migration epic.

Possible approach

  • Support non-negated, case-sensitive LIKE patterns that are either exact strings or anchored prefixes.
  • Rewrite them against min/max or bounded-min/bounded-max string stats.
  • Keep suffix, contains, case-insensitive, and escaped-pattern behavior out of scope until the semantics are specified and tested.

Testing

Add expression rewrite tests and zoned-layout pruning tests showing that true rewrite results only prove the original LIKE predicate is false for the zone.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions