Skip to content

Commit

Permalink
Closes #3757: ak.array gives unexpected results on a transposed numpy…
Browse files Browse the repository at this point in the history
… multi-dimensional array. (#3761)

Co-authored-by: Amanda Potts <[email protected]>
  • Loading branch information
ajpotts and ajpotts authored Sep 26, 2024
1 parent 6ad6fc6 commit 0b3186d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arkouda/pdarraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ def array(
raise RuntimeError(
"Array exceeds allowed transfer size. Increase ak.client.maxTransferBytes to allow"
)
# Make a copy to avoid error #3757
a = a.copy()
# Pack binary array data into a bytes object with a command header
# including the dtype and size. If the server has a different byteorder
# than our numpy array we need to swap to match since the server expects
Expand Down
12 changes: 12 additions & 0 deletions tests/pdarray_creation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest

import arkouda as ak
from arkouda.testing import assert_arkouda_array_equal

INT_SCALARS = list(ak.dtypes.int_scalars.__args__)
NUMERIC_SCALARS = list(ak.dtypes.numeric_scalars.__args__)
Expand Down Expand Up @@ -104,6 +105,17 @@ def test_array_creation_misc(self):
with pytest.raises(TypeError):
ak.array(list(list(0)))

@pytest.mark.skip_if_max_rank_less_than(2)
def test_array_creation_transpose_bug_reproducer(self):

import numpy as np

rows = 5
cols = 5
nda = np.random.randint(1, 10, (rows, cols))

assert_arkouda_array_equal(ak.transpose(ak.array(nda)), ak.array(np.transpose(nda)))

def test_infer_shape_from_size(self):
from arkouda.util import _infer_shape_from_size

Expand Down

0 comments on commit 0b3186d

Please sign in to comment.