leung-ming commented on code in PR #1893: URL: https://github.com/apache/datafusion-comet/pull/1893#discussion_r2179733980
########## native/spark-expr/src/utils.rs: ########## @@ -223,6 +228,20 @@ pub fn is_valid_decimal_precision(value: i128, precision: u8) -> bool { && value <= MAX_DECIMAL128_FOR_EACH_PRECISION[precision as usize] } +/// Build a boolean buffer from the state and reset the state, based on the emit_to +/// strategy. +pub fn build_bool_state(state: &mut BooleanBufferBuilder, emit_to: &EmitTo) -> BooleanBuffer { + let bool_state: BooleanBuffer = state.finish(); + + match emit_to { + EmitTo::All => bool_state, + EmitTo::First(n) => { + state.append_buffer(&bool_state.slice(*n, bool_state.len() - n)); Review Comment: Instead of appending bit by bit and not sure whether it is optimized or not(I believe it is not), `append_buffer` know how many bits to append and appends the bits at word size(64 bits by arrow implementation) granularity. -- 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