Commit 583f4db
committed
refactor: remove stats init in favor of cumulative RG pruning + add SLT tests
Remove try_init_topk_threshold and compute_best_threshold_from_stats.
Stats init had multiple issues:
- Gt vs GtEq boundary (excluded valid top-K values)
- Conflicted with cumulative prune when K spans multiple RGs
- Type coercion (CastExpr) and WHERE clause interaction
Cumulative RG pruning is strictly better: works with WHERE, no
threshold computation, no type issues. After reorder + reverse,
just count rows from the front until >= K, truncate the rest.
Add comprehensive SLT tests:
- Test I: WITH ORDER + DESC LIMIT (stats init + cumulative prune)
- Test J: Non-overlapping RGs without WITH ORDER (DynamicFilter path)
- Test K: Overlapping RGs (cumulative prune must NOT trigger)1 parent 7c42666 commit 583f4db
2 files changed
Lines changed: 294 additions & 638 deletions
0 commit comments