morrySnow opened a new pull request, #67888:
URL: https://github.com/apache/doris/pull/67888

   ## Problem
   
   Composite RANGE partition pruning can discard a partition that contains a 
matching tuple. For a partition with bounds `[(1, 10, 100), (100, 20, 200))`, 
predicates such as `(k1, k2, k3) = (1, 11, 50)` and `(100, 19, 250)` are valid 
by lexicographic ordering, while `(100, 20, 199)` is also below the exclusive 
upper tuple. Some expanded and unexpanded pruning paths nevertheless treat a 
suffix column as independently bounded and prune these rows.
   
   ## Root cause
   
   The two pruning paths model composite tuple bounds separately. Input range 
construction applies an exclusive upper bound to a non-terminal column, even 
though equality there must defer the decision to the suffix. Predicate 
refinement records a qualifying `OTHER` column but continues scanning, so a 
later suffix can overwrite the first decisive column. Expanded literals can 
also fold predicates to `TRUE`, removing the range entry needed by the 
refinement path.
   
   ## Reproduction
   
   Create a three-column RANGE partition with bounds `[(1, 10, 100), (100, 20, 
200))`, insert the tuples above, and filter on all three partition columns. 
Changing `partition_pruning_expand_threshold` exercises the expanded and 
unexpanded paths. Before this change, valid tuples can produce a zero-partition 
scan or an empty result.
   
   ## Fix
   
   Use one explicit lexicographic bound state for both input range construction 
and predicate refinement. Lower bounds constrain the first unresolved column 
inclusively; upper bounds constrain non-terminal columns inclusively and only 
the final column exclusively. Once a prefix diverges, suffix columns remain 
unbounded. Refinement now stops immediately at the first decisive `OTHER` 
column and conservatively falls back to the input range when an expanded 
equality has folded away.
   
   ## Tests
   
   - `./run-fe-ut.sh --run 
org.apache.doris.nereids.rules.rewrite.PartitionPrunerTest`
   - `DISABLE_BUILD_UI=ON ./build.sh --fe`
   - `./run-regression-test.sh --run -f 
regression-test/suites/nereids_rules_p0/partition_prune/test_lexicographic_range_partition.groovy`
   


-- 
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]

Reply via email to