AlenkaF commented on code in PR #40064:
URL: https://github.com/apache/arrow/pull/40064#discussion_r1489457766


##########
cpp/src/arrow/record_batch.cc:
##########
@@ -247,6 +248,109 @@ Result<std::shared_ptr<StructArray>> 
RecordBatch::ToStructArray() const {
                                        /*offset=*/0);
 }
 
+template <typename DataType>
+inline void ConvertColumnsToTensor(const RecordBatch& batch, uint8_t* out) {
+  using CType = typename arrow::TypeTraits<DataType>::CType;
+  auto* out_values = reinterpret_cast<CType*>(out);
+
+  // Loop through all of the columns
+  for (int i = 0; i < batch.num_columns(); ++i) {
+    const auto& arr = *batch.column(i);
+    auto data = arr.data();
+    const auto data_offset = data->offset * sizeof(CType);
+    const auto& in_values =
+        reinterpret_cast<const CType*>(data->buffers[1]->data() + data_offset);

Review Comment:
   Seems so. If I change the line 262 and remove the definition of 
`data_offset` all tests pass.



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