zanmato1984 commented on code in PR #39606:
URL: https://github.com/apache/arrow/pull/39606#discussion_r1453604495


##########
cpp/src/arrow/compute/row/compare_internal.cc:
##########
@@ -224,8 +224,10 @@ void KeyCompare::CompareBinaryColumnToRow(uint32_t 
offset_within_row,
             uint64_t key_right = key_right_ptr[i];
             result_or |= key_left ^ key_right;
           }
-          uint64_t key_left = util::SafeLoad(key_left_ptr + i);
-          uint64_t key_right = key_right_ptr[i];
+          uint64_t key_left = 0;
+          memcpy(&key_left, key_left_ptr + i, length - num_loops_less_one * 8);

Review Comment:
   > `length - num_loops_less_one * 8` is used several times in this closure, 
can you factor it out and give it a meaningful name (perhaps `num_tail_bytes`)?
   
   Yeah, that's reasonable. Done.
   
   > But, actually, isn't `length - num_loops_less_one * 8` simply equal to 
`length`?
   
   Sorry I don't quite understand how this is coming. For instance, for 
`fsb(19)` type, `length` will be `19` and `length - num_loops_less_one * 8` 
(aka. `num_tail_bytes`) will be `3`.
   



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

Reply via email to