Repository navigation
Closed
Labels
bugSomething isn't working
Description
This reproducer shows 2 bugs, one with arange correctly identifying bigints and with max_bits not actually getting applied to the resulting array of the concatenation
In [13]: a = ak.arange(2**200 - 1, 2**200+4)
In [14]: b = ak.arange(5, max_bits=3)
In [15]: b
Out[15]: array([0 1 2 3 4])
In [16]: a
Out[16]: array([1606938044258990275541962092341162602522202993782792835301375 1606938044258990275541962092341162602522202993782792835301376 1606938044258990275541962092341162602522202993782792835301377 1606938044258990275541962092341162602522202993782792835301378 1606938044258990275541962092341162602522202993782792835301379])
In [17]: ak.concatenate([b,a ])
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[17], line 1
----> 1 ak.concatenate([b,a ])
File /opt/homebrew/Caskroom/miniforge/base/envs/arkouda-dev/lib/python3.10/site-packages/typeguard/__init__.py:891, in typechecked.<locals>.wrapper(*args, **kwargs)
889 memo = _CallMemo(python_func, _localns, args=args, kwargs=kwargs)
890 check_argument_types(memo)
--> 891 retval = func(*args, **kwargs)
892 check_return_type(retval, memo)
894 # If a generator is returned, wrap it if its yield/send/return types can be checked
File ~/proj/arkouda/arkouda/pdarraysetops.py:331, in concatenate(arrays, ordered)
329 dtype = a.dtype
330 elif dtype != a.dtype:
--> 331 raise ValueError("All pdarrays must have same dtype")
332 names.append(cast(pdarray, a).name)
333 elif objtype == Strings.objType:
ValueError: All pdarrays must have same dtype
In [18]: b
Out[18]: array([0 1 2 3 4])
In [19]: b.dtype
Out[19]: dtype('int64')
In [20]: b = ak.arange(5, max_bits=3, dtype=ak.bigint)
In [21]: b
Out[21]: array([0 1 2 3 4])
In [22]: b.dtype
Out[22]: dtype(bigint)
In [23]: ak.concatenate([b,a ])
Out[23]: array([0 1 2 3 4 1606938044258990275541962092341162602522202993782792835301375 1606938044258990275541962092341162602522202993782792835301376 1606938044258990275541962092341162602522202993782792835301377 1606938044258990275541962092341162602522202993782792835301378 1606938044258990275541962092341162602522202993782792835301379])
In [24]: ak.concatenate([b,a ]).max_bits
Out[24]: -1
In [25]: b.max_bits = 3
In [26]: b.max_bits
Out[26]: 3
In [27]: ak.concatenate([b,a ]).max_bits
Out[27]: 3
In [28]: ak.concatenate([b,a ])
Out[28]: array([0 1 2 3 4 1606938044258990275541962092341162602522202993782792835301375 1606938044258990275541962092341162602522202993782792835301376 1606938044258990275541962092341162602522202993782792835301377 1606938044258990275541962092341162602522202993782792835301378 1606938044258990275541962092341162602522202993782792835301379])Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
[-]bigint concatenate mishandling `max_bits`[/-][+]concatenate and arange mishandling `max_bits`[/+][-]concatenate and arange mishandling `max_bits`[/-][+]`concatenate` and `arange` mishandling `max_bits`[/+]Fixes Bears-R-Us#2802: Concatenate and arange mishandling max_bits
Fixes #2802: Concatenate and arange mishandling max_bits (#2803)