westonpace commented on code in PR #35565:
URL: https://github.com/apache/arrow/pull/35565#discussion_r1205264185


##########
cpp/src/arrow/acero/source_node.cc:
##########
@@ -52,6 +52,45 @@ using arrow::internal::MapVector;
 namespace acero {
 namespace {
 
+Status HandleUnalignedBuffers(ExecBatch* batch, UnalignedBufferHandling 
handling) {
+  if (handling == UnalignedBufferHandling::kIgnore) {
+    return Status::OK();
+  }
+  for (auto& value : batch->values) {
+    if (value.is_array()) {
+      switch (handling) {
+        case UnalignedBufferHandling::kIgnore:
+          // Should be impossible to get here
+          return Status::OK();
+        case UnalignedBufferHandling::kAbort:
+          if (!arrow::util::CheckAlignment(*value.array(),
+                                           arrow::util::kValueAlignment)) {
+            return Status::Invalid(
+                "An input buffer was poorly aligned and 
UnalignedBufferHandling is set "
+                "to kAbort");
+          }
+          break;
+        case UnalignedBufferHandling::kWarn:
+          if (!arrow::util::CheckAlignment(*value.array(),
+                                           arrow::util::kValueAlignment)) {
+            ARROW_LOG(WARNING)
+                << "An input buffer was poorly aligned.  This could lead to 
crashes or "
+                   "poor performance on some hardware.  Please ensure that all 
Acero "
+                   "sources generate aligned buffers.";

Review Comment:
   Fixed.



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