| 1155 | |
| 1156 | @pytest.mark.numpy |
| 1157 | def test_recordbatch_to_tensor_nan(): |
| 1158 | arr1 = [1, 2, 3, 4, np.nan, 6, 7, 8, 9] |
| 1159 | arr2 = [10, 20, 30, 40, 50, 60, 70, np.nan, 90] |
| 1160 | batch = pa.RecordBatch.from_arrays( |
| 1161 | [ |
| 1162 | pa.array(arr1, type=pa.float32()), |
| 1163 | pa.array(arr2, type=pa.float32()), |
| 1164 | ], ["a", "b"] |
| 1165 | ) |
| 1166 | result = batch.to_tensor(row_major=False) |
| 1167 | x = np.column_stack([arr1, arr2]).astype(np.float32, order="F") |
| 1168 | expected = pa.Tensor.from_numpy(x) |
| 1169 | |
| 1170 | np.testing.assert_equal(result.to_numpy(), x) |
| 1171 | assert result.size == 18 |
| 1172 | assert result.type == pa.float32() |
| 1173 | assert result.shape == expected.shape |
| 1174 | assert result.strides == expected.strides |
| 1175 | |
| 1176 | |
| 1177 | @pytest.mark.numpy |