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

   Problem Summary:
   
   ### Background
   
   `bitmap_count(bitmap_op(...))` currently materializes an intermediate bitmap 
before counting. For patterns such as `bitmap_count(bitmap_and(...))`, 
`bitmap_count(bitmap_or(...))`, `bitmap_count(bitmap_xor(...))`, and 
`bitmap_count(bitmap_and_not(...))`, Doris already has corresponding 
`bitmap_*_count` functions that can compute the cardinality directly.
   
   Also, `bitmap_and_count`, `bitmap_or_count`, `bitmap_xor_count`, and 
`bitmap_and_not_count` are semantically always not null, but their previous 
metadata could be marked nullable when bitmap arguments were nullable.
   
   ### Changes
   
   - Add Nereids expression rewrite:
     - `bitmap_count(bitmap_and(...))` -> `bitmap_and_count(...)`
     - `bitmap_count(bitmap_or(...))` -> `bitmap_or_count(...)`
     - `bitmap_count(bitmap_xor(...))` -> `bitmap_xor_count(...)`
     - `bitmap_count(bitmap_not(...))` / `bitmap_and_not(...)` -> 
`bitmap_and_not_count(...)`
   
   - Mark bitmap op count scalar functions as always not nullable in Nereids.
   
   - Add BE v2 implementations for bitmap op count return type inference:
     - `bitmap_and_count_v2`
     - `bitmap_or_count_v2`
     - `bitmap_xor_count_v2`
     - `bitmap_and_not_count_v2`
   
   - Add `new_version_bitmap_op_count` query option to select the v2 BE 
implementations.
   
   - Optimize binary bitmap count execution paths to avoid intermediate bitmap 
materialization.
   
   - Fix `BitmapValue::or_cardinality` for SET/SET input.
   
   - Merge `bitmap_and_not` / `bitmap_andnot` aliases into `bitmap_not`.


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