alamb commented on code in PR #17977:
URL: https://github.com/apache/datafusion/pull/17977#discussion_r2524380285
##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs:
##########
@@ -56,6 +56,85 @@ where
nulls: MaybeNullBufferBuilder::new(),
}
}
+
+ fn vectorized_equal_to_non_nullable(
+ &self,
+ lhs_rows: &[usize],
+ array: &ArrayRef,
+ rhs_rows: &[usize],
+ equal_to_results: &mut [bool],
+ ) {
+ assert!(
+ !NULLABLE || (array.null_count() == 0 &&
!self.nulls.might_have_nulls()),
+ "called with nullable input"
+ );
+ let array_values = array.as_primitive::<T>().values();
+
+ let iter = izip!(
+ lhs_rows.iter(),
+ rhs_rows.iter(),
+ equal_to_results.iter_mut(),
+ );
+
+ for (&lhs_row, &rhs_row, equal_to_result) in iter {
+ let result = {
+ // Getting unchecked not only for bound checks but because the
bound checks are
+ // what prevents auto-vectorization
+ let left = if cfg!(debug_assertions) {
+ self.group_values[lhs_row]
+ } else {
+ // SAFETY: indices are guaranteed to be in bounds
+ unsafe { *self.group_values.get_unchecked(lhs_row) }
+ };
+ let right = if cfg!(debug_assertions) {
+ array_values[rhs_row]
+ } else {
+ // SAFETY: indices are guaranteed to be in bounds
+ unsafe { *array_values.get_unchecked(rhs_row) }
+ };
+
+ // Always evaluate, to allow for auto-vectorization
Review Comment:
this makes sense for primitive values -- namely that the cost of checking if
we should compare dominated just always comparing
--
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]