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


##########
cpp/src/arrow/compute/row/CMakeLists.txt:
##########
@@ -19,3 +19,5 @@
 # in a row-major order.
 
 arrow_install_all_headers("arrow/compute/row")
+
+add_arrow_compute_test(compare_test SOURCES compare_test.cc)

Review Comment:
   Could you add this to `internals_test` instead?



##########
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`)?
   
   But, actually, isn't `length - num_loops_less_one * 8` simply equal to 
`length`?
   



##########
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);
+          uint64_t key_right = 0;
+          memcpy(&key_right, key_right_ptr + i, length - num_loops_less_one * 
8);
           result_or |= tail_mask & (key_left ^ key_right);

Review Comment:
   Is `tail_mask` still useful here? We're extracting exactly the desired 
number of bytes.



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