gene-db opened a new pull request, #41623:
URL: https://github.com/apache/spark/pull/41623

   ### What changes were proposed in this pull request?
   
   Implemented bitmap functions. The functions are:
   - `bitmap_bucket_number()`: returns the bucket number for a given input 
number
   - `bitmap_bit_position()`: returns bit position for a given input number
   - `bitmap_count()`: returns the number of set bits from an input bitmap
   - `bitmap_construct_agg()`: aggregation function that aggregates input bit 
positions, and creates a bitmap
   - `bitmap_or_agg()`: aggregation function that performs a bitwise OR on all 
the input bitmaps
   
   ### Why are the changes needed?
   
   These functions can be used to count distinct values for integer columns. 
For example:
   
   ```sql
   SELECT sum(cnt) FROM (
     SELECT bitmap_bucket_number(c), 
bitmap_count(bitmap_construct_agg(bitmap_bit_position(c))) cnt
     FROM table GROUP BY 1
   )
   ```
   
   is equivalent to:
   
   ```sql
   SELECT count(distinct c) FROM table
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. After this PR, these functions are usable in queries.
   
   ### How was this patch tested?
   
   New tests were added.


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