jorisvandenbossche commented on code in PR #40867:
URL: https://github.com/apache/arrow/pull/40867#discussion_r1549850748


##########
cpp/src/arrow/record_batch.cc:
##########
@@ -283,18 +283,55 @@ struct ConvertColumnsToTensorVisitor {
   }
 };
 
+template <typename Out>
+struct ConvertColumnsToTensorRowMajorVisitor {
+  Out*& out_values;
+  const ArrayData& in_data;
+  int num_cols;
+  int i;

Review Comment:
   To make this a more meaningful variable name, this is the column index, 
right? So eg `col_idx`?



##########
cpp/src/arrow/record_batch_test.cc:
##########
@@ -682,7 +682,8 @@ TEST_F(TestRecordBatch, ToTensorEmptyBatch) {
   ASSERT_OK_AND_ASSIGN(std::shared_ptr<RecordBatch> empty,
                        RecordBatch::MakeEmpty(schema));
 
-  ASSERT_OK_AND_ASSIGN(auto tensor, empty->ToTensor());
+  ASSERT_OK_AND_ASSIGN(auto tensor,
+                       empty->ToTensor(/*null_to_nan=*/false, 
/*row_major=*/false));
   ASSERT_OK(tensor->Validate());
 
   const std::vector<int64_t> strides = {4, 4};

Review Comment:
   The strides wouldn't be different here for row major, I suppose? Might be 
good to explicitly test both



##########
python/pyarrow/tests/test_table.py:
##########
@@ -1106,7 +1135,7 @@ def test_recordbatch_to_tensor_empty():
             pa.array([], type=pa.float32()),
         ], ["a", "b"]
     )
-    result = batch.to_tensor()
+    result = batch.to_tensor(row_major=False)
 
     x = np.array([[], []], np.float32).transpose()

Review Comment:
   ```suggestion
       result = batch.to_tensor()
   
       x = np.array([[], []], np.float32)
   ```



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