Skip to content

fix(expression): use upper bound for InclusiveMetricsEvaluator StartsWith when lower bound is missing - #1187

Merged
zhjwpku merged 1 commit into
apache:mainfrom
deepaknettem:fix/inclusive-metrics-starts-with-missing-lower-bound
Nov 28, 2026
Merged

zhjwpku merged 1 commit into
apache:mainfrom
deepaknettem:fix/inclusive-metrics-starts-with-missing-lower-bound

Conversation

@deepaknettem

Copy link
Copy Markdown
Contributor

Problem

Follow-up to #1156 and #1177.

In InclusiveMetricsEvaluator::StartsWith, if lower_bounds is missing, the evaluator returns kRowsMightMatch immediately and skips the upper_bounds check. For example, a file with no lower bound and upper_bounds = "dC" is still read for StartsWith("required", "e") or StartsWith("required", "dCa"), even though no value in the file can match.

Fix

  • Only run the lower-bound check when lower_bounds is present and non-null, and still fall through to prune against upper_bounds
  • Use std::string_view::compare(0, prefix.size(), prefix) > 0 for the lower bound and upper_str < prefix for the upper bound. This matches the StrictMetricsEvaluator::NotStartsWith implementation from feat(expression): implement NotStartsWith in StrictMetricsEvaluator #1177.

Tests

Add basic unit tests.

@deepaknettem deepaknettem changed the title fix(expression): use upper bound for StartsWith when lower bound is missing fix(expression): use upper bound for InclusiveMetricsEvaluator StartsWith when lower bound is missing Nov 27, 2026

@zhjwpku zhjwpku left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhjwpku
zhjwpku merged commit 2f8d2f5 into apache:main Nov 28, 2026
15 checks passed
@zhjwpku

zhjwpku commented Nov 28, 2026

Copy link
Copy Markdown
Member

Thank @deepaknettem for the improvement.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants