Baymine opened a new issue, #66293: URL: https://github.com/apache/doris/issues/66293
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues. ### Description A predicate that wraps a column in a monotonic (or piecewise floor/ceil) function cannot be consumed by any storage-layer min/max statistics today, because those statistics are kept on the **bare column**, not on the wrapped expression. Examples: - `date_trunc(dt_col, 'day') = '2026-03-26'` - `year(dt_col) >= 2024` - `*_ceil` / `*_floor` families - `from_unixtime(epoch_col) >= '...'` - `to_date(dt_col)`, `to_monday(dt_col)` - binary-collation prefix: `substring(s_col, 1, 3) = 'abc'` / `left(s_col, 3) >= 'abc'` As a result ORC/Parquet row-group pruning, OLAP zonemap pruning, and partition pruning all miss these predicates and scan far more data than necessary. ### Solution Add a Nereids expression-rewrite rule that, for a predicate over a monotonic function of a column, derives an **additional** bare-column range predicate consumable by any min/max statistic, while always preserving the original predicate (the derived one is a one-way / relaxed implication, so the original still does the exact filtering and query results are unchanged). Gate it behind a session variable defaulting to on. Soundness gates: - **from_unixtime:** a DST/zone-offset guard — the epoch→local map is only strictly monotonic on a stretch with no UTC-offset transition, so the rule derives nothing when a transition falls in the guarded interval. - **prefix functions:** emitted only under binary collation, where lexicographic byte order matches string order. - **date_trunc / floor units:** the `[c, c + 1 unit)` bound is built from the exact trunc unit via the reused `*Add` scalar functions, so leap-year / month-end clamp reversibility is preserved. ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
