Open guilhermeleobas opened 4 years ago
The recommended workflow that demonstrates the issue is:
In [1]: import rbc
In [2]: import numba
In [3]: at = rbc.typesystem.Type('int32[]')
In [4]: target_info = rbc.targetinfo.TargetInfo.host()
In [5]: rt = rbc.typesystem.Type.fromnumba(numba.int32[:], target_info)
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-5-9c218fec7bdd> in <module>
----> 1 rt = rbc.typesystem.Type.fromnumba(numba.int32[:], target_info)
~/git/xnd-project/rbc/rbc/typesystem.py in fromnumba(cls, t, target_info)
680 if isinstance(t, nb.types.misc.CPointer):
681 return cls(cls.fromnumba(t.dtype, target_info), '*')
--> 682 raise NotImplementedError(repr(t))
683
684 @classmethod
NotImplementedError: array(int32, 1d, A)
If the above is fixed, then continue:
rt(at)
Another problem is that rbc.typesystem.Type("int32[]")
and numba.int32[:]
produce different array structures. It would be nice to unify these. The problem boils down to how to map numba array(int32, 1d, A)
to omniscidb Array
.
~I believe this was partially fixed on #41.~ Removed to limit the pull request scope. Will add this in a later PR.
In [1]: import rbc
In [2]: import numba
In [3]: target_info = rbc.targetinfo.TargetInfo.host()
In [4]: at = rbc.typesystem.Type.fromstring('int32[:]', target_info)
In [5]: rt = rbc.typesystem.Type.fromnumba(numba.int32[:], target_info)
In [6]: at
Out[6]: Type(Type('int32',), '[:]')
In [7]: rt
Out[7]: Type(Type('int32',), '[:]')
The current state is:
In [19]: rt = rbc.typesystem.Type.fromnumba(numba.int32[:], target_info)
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-19-9c218fec7bdd> in <module>
----> 1 rt = rbc.typesystem.Type.fromnumba(numba.int32[:], target_info)
~/git/xnd-project/rbc/rbc/typesystem.py in fromnumba(cls, t, target_info)
713 if isinstance(t, nb.types.misc.CPointer):
714 return cls(cls.fromnumba(t.dtype, target_info), '*')
--> 715 raise NotImplementedError(repr(t))
716
717 @classmethod
NotImplementedError: array(int32, 1d, A)
Thoughts:
{*int32, int64, *int8}
.{<fill me in>}
array(int32, 1d, A)
represents 1-D array with items of type int32. Numba array is abstract in the sense that it does not specify implementation. Numba ArrayModel does that.Marked as code quality because it would be nice for the completeness of the typesystem if
rt = rbc.typesystem.Type.fromnumba(numba.int32[:], target_info)
would work. Otherwise, this is not required for omnisci and numpy array connection.
The code above fails with the following error: