Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update backport for changes in Numba, NumExpr, Arrow, and RDataFrame #2735

Merged
merged 16 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION_INFO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.4
1.10.5
7 changes: 4 additions & 3 deletions src/awkward/_connect/_numba/arrayview.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numba
import numba.core.typing
import numba.core.typing.ctypes_utils
from numba.core.errors import NumbaTypeError

import awkward as ak

Expand Down Expand Up @@ -586,7 +587,7 @@ def generic(self, args, kwargs):
viewtype, wheretype
)
else:
raise TypeError(
raise NumbaTypeError(
"only an integer, start:stop range, or a *constant* "
"field name string may be used as ak.Array "
"slices in compiled code" + ak._util.exception_suffix(__file__)
Expand Down Expand Up @@ -874,7 +875,7 @@ def generic(self, args, kwargs):
recordviewtype, wheretype.literal_value
)(recordviewtype, wheretype)
else:
raise TypeError(
raise NumbaTypeError(
"only a *constant* field name string may be used as "
"ak.Record slices in compiled code"
+ ak._util.exception_suffix(__file__)
Expand Down Expand Up @@ -1504,7 +1505,7 @@ def generic(self, args, kwargs):
return rettype(partviewtype, wheretype)

else:
raise TypeError(
raise NumbaTypeError(
"only an integer, start:stop range, or a *constant* "
"field name string may be used as ak.Array "
"slices in compiled code" + ak._util.exception_suffix(__file__)
Expand Down
27 changes: 14 additions & 13 deletions src/awkward/_connect/_numba/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import numba
import numba.core.typing
import numba.core.typing.ctypes_utils
from numba.core.errors import NumbaTypeError

import awkward as ak

Expand Down Expand Up @@ -145,7 +146,7 @@ def resolve_clear(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.clear"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -155,7 +156,7 @@ def resolve_null(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.null"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -169,7 +170,7 @@ def resolve_boolean(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.boolean"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -183,7 +184,7 @@ def resolve_integer(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.integer"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -197,7 +198,7 @@ def resolve_real(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.real"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -207,7 +208,7 @@ def resolve_begin_list(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.begin_list"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -217,7 +218,7 @@ def resolve_end_list(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.end_list"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -231,7 +232,7 @@ def resolve_begin_tuple(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.begin_tuple"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -245,7 +246,7 @@ def resolve_index(self, arraybuildertype, args, kwargs):
):
return arraybuildertype(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.index"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -255,7 +256,7 @@ def resolve_end_tuple(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.end_tuple"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -271,7 +272,7 @@ def resolve_begin_record(self, arraybuildertype, args, kwargs):
):
return numba.types.none(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.begin_record"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -285,7 +286,7 @@ def resolve_field(self, arraybuildertype, args, kwargs):
):
return arraybuildertype(args[0])
else:
raise TypeError(
raise NumbaTypeError(
"wrong number or types of arguments for ArrayBuilder.field"
+ ak._util.exception_suffix(__file__)
)
Expand All @@ -295,7 +296,7 @@ def resolve_end_record(self, arraybuildertype, args, kwargs):
if len(args) == 0 and len(kwargs) == 0:
return numba.types.none()
else:
raise TypeError(
raise NumbaTypeError(
"wrong number of arguments for ArrayBuilder.end_record"
+ ak._util.exception_suffix(__file__)
)
Expand Down
27 changes: 14 additions & 13 deletions src/awkward/_connect/_numba/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import numba

import awkward as ak
from numba.core.errors import NumbaTypeError, NumbaValueError

np = ak.nplike.NumpyMetadata.instance()
numpy = ak.nplike.Numpy.instance()
Expand Down Expand Up @@ -41,7 +42,7 @@
@numba.extending.typeof_impl.register(ak.layout.Index64)
@numba.extending.typeof_impl.register(ak.layout.Record)
def fake_typeof(obj, c):
raise TypeError(
raise NumbaTypeError(
"{} objects cannot be passed directly into Numba-compiled functions; "
"construct a high-level ak.Array or ak.Record instead".format(
type(obj).__name__
Expand Down Expand Up @@ -334,7 +335,7 @@ def getitem_field(self, viewtype, key):
self, viewtype, viewtype.fields + (key,)
)
else:
raise TypeError(
raise NumbaTypeError(
f"array does not have a field with key {key!r}"
+ ak._util.exception_suffix(__file__)
)
Expand Down Expand Up @@ -2018,14 +2019,14 @@ def getitem_at(self, viewtype):
index = self.fieldindex(key)
if index is None:
if self.recordlookup is None:
raise ValueError(
raise NumbaValueError(
"no field {} in tuples with {} fields".format(
repr(key), len(self.contenttypes)
)
+ ak._util.exception_suffix(__file__)
)
else:
raise ValueError(
raise NumbaValueError(
"no field {} in records with "
"fields: [{}]".format(
repr(key), ", ".join(repr(x) for x in self.recordlookup)
Expand All @@ -2042,14 +2043,14 @@ def getitem_field(self, viewtype, key):
index = self.fieldindex(key)
if index is None:
if self.recordlookup is None:
raise ValueError(
raise NumbaValueError(
"no field {} in tuples with {} fields".format(
repr(key), len(self.contenttypes)
)
+ ak._util.exception_suffix(__file__)
)
else:
raise ValueError(
raise NumbaValueError(
"no field {} in records with fields: [{}]".format(
repr(key), ", ".join(repr(x) for x in self.recordlookup)
)
Expand All @@ -2063,14 +2064,14 @@ def getitem_field_record(self, recordviewtype, key):
index = self.fieldindex(key)
if index is None:
if self.recordlookup is None:
raise ValueError(
raise NumbaValueError(
"no field {} in tuple with {} fields".format(
repr(key), len(self.contenttypes)
)
+ ak._util.exception_suffix(__file__)
)
else:
raise ValueError(
raise NumbaValueError(
"no field {} in record with fields: [{}]".format(
repr(key), ", ".join(repr(x) for x in self.recordlookup)
)
Expand Down Expand Up @@ -2391,21 +2392,21 @@ def hasfield(self, key):

def getitem_at(self, viewtype):
if not all(isinstance(x, RecordArrayType) for x in self.contenttypes):
raise TypeError(
raise NumbaTypeError(
"union types cannot be accessed in Numba"
+ ak._util.exception_suffix(__file__)
)

def getitem_range(self, viewtype):
if not all(isinstance(x, RecordArrayType) for x in self.contenttypes):
raise TypeError(
raise NumbaTypeError(
"union types cannot be accessed in Numba"
+ ak._util.exception_suffix(__file__)
)

def getitem_field(self, viewtype, key):
if not all(isinstance(x, RecordArrayType) for x in self.contenttypes):
raise TypeError(
raise NumbaTypeError(
"union types cannot be accessed in Numba"
+ ak._util.exception_suffix(__file__)
)
Expand Down Expand Up @@ -2605,7 +2606,7 @@ def getitem_at(form):
elif form.primitive == "bool":
return numba.boolean
else:
raise ValueError(
raise NumbaValueError(
"unrecognized NumpyForm.primitive type: {}".format(
form.primitive
)
Expand Down Expand Up @@ -2641,7 +2642,7 @@ def getitem_at(form):
return arrayview.type.getitem_at(arrayview)

elif isinstance(form, ak.forms.UnionForm):
raise TypeError(
raise NumbaTypeError(
"union types cannot be accessed in Numba"
+ ak._util.exception_suffix(__file__)
)
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_connect/_numexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def evaluate(
):
numexpr = import_numexpr()

context = numexpr.necompiler.getContext(kwargs, frame_depth=1)
context = numexpr.necompiler.getContext(kwargs)
expr_key = (expression, tuple(sorted(context.items())))
if expr_key not in numexpr.necompiler._names_cache:
numexpr.necompiler._names_cache[expr_key] = numexpr.necompiler.getExprNames(
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_v2/_connect/numexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def evaluate(
):
numexpr = import_numexpr()

context = numexpr.necompiler.getContext(kwargs, frame_depth=1)
context = numexpr.necompiler.getContext(kwargs)
expr_key = (expression, tuple(sorted(context.items())))
if expr_key not in numexpr.necompiler._names_cache:
numexpr.necompiler._names_cache[expr_key] = numexpr.necompiler.getExprNames(
Expand Down
Loading