pitrou commented on a change in pull request #12089:
URL: https://github.com/apache/arrow/pull/12089#discussion_r786159718



##########
File path: cpp/src/arrow/compute/exec.cc
##########
@@ -110,6 +112,78 @@ int64_t ExecBatch::TotalBufferSize() const {
   return sum;
 }
 
+bool AddBuffersToSet(const ArrayData& array_data,
+                     std::unordered_set<std::shared_ptr<Buffer>>* 
seen_buffers) {

Review comment:
       Nit: to reduce the performance overhead, `std::unordered_set<Buffer*>` 
would be better.

##########
File path: cpp/src/arrow/compute/exec.cc
##########
@@ -706,6 +790,17 @@ class ScalarExecutor : public 
KernelExecutorImpl<ScalarKernel> {
         DCHECK(out.array()->buffers[0])
             << "Null bitmap deleted by kernel but can_write_into_slices = 
true";
       }
+
+#ifndef NDEBUG
+      // Check whether the kernel allocated new Buffers
+      // (instead of using the preallocated ones)
+      bool insertion_occured = AddBuffersToSet(out, &pre_buffers);
+      if (insertion_occured) {
+        return Status::ExecutionError(

Review comment:
       `ExecutionError` a Gandiva-specific error. Perhaps use `Status::Invalid`?




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