mapleFU commented on code in PR #41975:
URL: https://github.com/apache/arrow/pull/41975#discussion_r1636654271


##########
cpp/src/arrow/compute/exec.cc:
##########
@@ -473,7 +485,7 @@ bool ExecSpanIterator::Next(ExecSpan* span) {
 namespace {
 
 struct NullGeneralization {
-  enum type { PERHAPS_NULL, ALL_VALID, ALL_NULL };
+  enum type { PERHAPS_NULL = 1, ALL_VALID = 2, ALL_NULL = 3 };

Review Comment:
   Would this introducing a undefined value here? (return 0)



##########
cpp/src/arrow/compute/exec.cc:
##########
@@ -1123,6 +1142,34 @@ class VectorExecutor : public 
KernelExecutorImpl<VectorKernel> {
     }
   }
 
+  Status SetupPreallocation(const std::vector<Datum>& args) {

Review Comment:
   Whats the difference between it and `SetupPreallocation` in Scalar?



##########
cpp/src/arrow/compute/exec.cc:
##########
@@ -738,12 +772,10 @@ class KernelExecutorImpl : public KernelExecutor {
     }
     for (size_t i = 0; i < data_preallocated_.size(); ++i) {
       const auto& prealloc = data_preallocated_[i];
-      if (prealloc.bit_width >= 0) {

Review Comment:
   Yes, seems this could be a DCHECK?



##########
cpp/src/arrow/compute/exec.cc:
##########
@@ -966,12 +998,6 @@ class ScalarExecutor : public 
KernelExecutorImpl<ScalarKernel> {
          data_preallocated_.size() == static_cast<size_t>(output_num_buffers_ 
- 1) &&
          !is_nested(out_type_id) && !is_dictionary(out_type_id));
 
-    // TODO(wesm): why was this check ever here? Fixed width binary

Review Comment:
   Maybe keeping this because it's only a debug build?



##########
cpp/src/arrow/compute/exec.cc:
##########
@@ -498,15 +510,36 @@ struct NullGeneralization {
     return PERHAPS_NULL;
   }
 
+  static type Get(const ChunkedArray& chunk_array) {
+    if (chunk_array.num_chunks() == 0 ||
+        (chunk_array.null_count() == chunk_array.length())) {
+      return ALL_NULL;
+    }
+
+    type null_gen = ALL_NULL;
+    int chunk_idx = 0;
+    while (chunk_idx < chunk_array.num_chunks()) {
+      ExecValue value;
+      const ArrayData* curr_chunk = chunk_array.chunk(chunk_idx)->data().get();
+      value.SetArray(*curr_chunk);

Review Comment:
   ```suggestion
         const ArrayData& curr_chunk = chunk_array.chunk(chunk_idx)->data();
         value.SetArray(curr_chunk);
   ```
   
   Or construct a `ArraySpan`?



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