Dandandan commented on issue #15631: URL: https://github.com/apache/datafusion/issues/15631#issuecomment-2786341929
Interesting! I think we probably can take some inspiration from arrow-rs aggregate code, e.g. doing something like (?): ```rust /// Counts the number of ones pub fn count_ones(&self) -> usize { // platform specific const LANES: usize = 8; let mut chunks = self.chunks.chunks_exact(LANES); let mut sum: usize = 0; chunks.borrow_mut().for_each(|chunk| { let chunk: [u64; LANES] = chunk.try_into().unwrap(); for i in 0..LANES { sum += chunk[i].count_ones() as usize; } }); let remainder = chunks.remainder(); for chunk in remainder { sum += chunk.count_ones() as usize; } sum } ``` (Didn't test this to be faster). We could also define a faster version for this use case that doesn't count but returns the same as max / min boolean. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org