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

   ## Problem
   
   A query with a valid partition predicate can be rejected by a 
`require_partition_filter` SQL block rule when partition pruning initially 
selects both a non-empty partition and an empty partition.
   
   ## Cause
   
   Partition pruning records that the scan has a partition predicate. 
Empty-partition pruning then copies the scan through the one-argument 
`withSelectedPartitionIds` method, which reset that flag to `false`. The 
table-stream scan override had the same copy behavior.
   
   ## Reproduction
   
   Create a range-partitioned table where the middle partition is empty, enable 
`require_partition_filter`, and query with a predicate spanning the first two 
partitions (for example, `id < 10`). The scan is reduced to the non-empty first 
partition, but the query is incorrectly rejected as missing a partition filter.
   
   ## Fix
   
   - Preserve the existing partition-predicate flag when copying regular and 
table-stream OLAP scans with a new selected-partition list.
   - Keep the explicit two-argument overload available for callers that 
intentionally set the flag.
   - Add unit coverage for both scan types and regression coverage for a 
predicate spanning a non-empty and an empty partition.
   
   ## Testing
   
   - `LogicalOlapScanTest` (6 tests)
   - Full FE build and checkstyle
   - `sql_block_rule_p0/test_sql_block_rule.groovy`
   - Runtime verification for valid and missing partition predicates
   


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