sanjibansg commented on code in PR #14758:
URL: https://github.com/apache/arrow/pull/14758#discussion_r1140061585


##########
cpp/src/arrow/util/align_util.cc:
##########
@@ -26,56 +26,63 @@ namespace arrow {
 
 namespace util {
 
-Result<std::shared_ptr<Array>> EnsureAlignment(const Array& object, int64_t 
alignment,
+Result<std::shared_ptr<Buffer>> EnsureAlignment(const std::shared_ptr<Buffer>& 
object, int64_t alignment,
                                                MemoryPool* memory_pool) {
-  std::vector<std::shared_ptr<Buffer>> buffers_ = object.data()->buffers;
+    auto buffer_address = object->address();
+    if ((buffer_address % alignment) != 0) {
+        ARROW_ASSIGN_OR_RAISE(
+                auto new_buffer, AllocateBuffer(object->size(), alignment, 
memory_pool));
+        std::memcpy(new_buffer->mutable_data(), object->data(), 
object->size());
+        return new_buffer;
+    } else {
+        return object;

Review Comment:
   Made the change, thanks!



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