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



##########
File path: cpp/src/arrow/adapters/orc/adapter_util.cc
##########
@@ -316,10 +326,525 @@ Status AppendBatch(const liborc::Type* type, 
liborc::ColumnVectorBatch* batch,
   }
 }
 
+template <class array_type, class batch_type>
+Status FillNumericBatch(const DataType* type, liborc::ColumnVectorBatch* 
cbatch,
+                        int64_t& arrowOffset, int64_t& orcOffset, int64_t 
length,
+                        Array* parray, std::vector<bool>* incomingMask) {
+  auto array = checked_cast<array_type*>(parray);
+  auto batch = checked_cast<batch_type*>(cbatch);
+  int64_t arrowLength = array->length();
+  if (!arrowLength) {
+    return Status::OK();
+  }
+  if (array->null_count() || incomingMask) {
+    batch->hasNulls = true;
+  }
+  for (; orcOffset < length && arrowOffset < arrowLength; orcOffset++, 
arrowOffset++) {
+    if (array->IsNull(arrowOffset) || (incomingMask && 
!(*incomingMask)[orcOffset])) {
+      batch->notNull[orcOffset] = false;
+    } else {
+      batch->data[orcOffset] = array->Value(arrowOffset);
+      batch->notNull[orcOffset] = true;
+    }
+  }
+  batch->numElements = orcOffset;

Review comment:
       According to the example in https://orc.apache.org/docs/core-cpp.html, 
`numElements` should be the number of rows in _this_ batch only. But 
`orcOffset` would be the number of rows from the beginning, no?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to