foxtail463 opened a new pull request, #66288: URL: https://github.com/apache/doris/pull/66288
Problem Summary: When a partition predicate wraps the partition column in a monotonic/rounding function — date_trunc(dt,'day') >= '2020-01-05', year(dt) = 2020, substring(col,1,n) >= 'abc', col + INTERVAL '1 5' DAY_HOUR > '...' — partition pruning cannot binary-search the sorted partition list, which only understands the "bare column op literal" shape. These queries fall back to per-partition evaluation and scan more partitions than necessary. Solution: Add InferPredicateFromMonotonicFunction, invoked in PartitionPruner.pruneInternal, which derives an extra bare-column predicate that is a necessary condition of the original (floor(x) <= x, ceil(x) >= x, prefix(s) <= s, year boundary dates) and appends it with AND. Derived predicates are marked inferred so they stay local to pruning and are never written back as runtime filters; rounding-argument safety is validated (positive period, ceil rejects custom origin). As supporting changes, expose isFloor()/isCeil() on the rounding scalar functions, route compound-unit intervals through DATE_ADD/DATE_SUB, and extend the comparison-simplification reverse map so column ± interval predicates reduce to bare-column form. -- 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]
