Skip to content

Commit

Permalink
Revert "fix(ScalarFunction): add (currently) required error enum"
Browse files Browse the repository at this point in the history
This reverts commit 135320b.
  • Loading branch information
wjones127 committed Oct 28, 2022
1 parent 45f03d8 commit 3266277
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
17 changes: 1 addition & 16 deletions ibis_substrait/compiler/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,27 +478,12 @@ def value_op(
compiler: SubstraitCompiler,
**kwargs: Any,
) -> stalg.Expression:
error_args = []
# TODO(gforsyth): remove this brittle workaround after extension parsing is ready
# TODO(gforsyth): sending in `ERROR` for floating point ops doesn't match
# the substrait spec but is what pyarrow currently expects.
if (
isinstance(op, ops.BinaryOp)
and not isinstance(op, ops.Comparison)
and isinstance(op.left.type(), (dt.Integer, dt.Floating))
and isinstance(op.right.type(), (dt.Integer, dt.Floating))
):
error_args.append(
stalg.FunctionArgument(enum=stalg.FunctionArgument.Enum(specified="ERROR"))
)

# given the details of `op` -> function id
return stalg.Expression(
scalar_function=stalg.Expression.ScalarFunction(
function_reference=compiler.function_id(expr),
output_type=translate(expr.type()),
arguments=error_args
+ [
arguments=[
stalg.FunctionArgument(value=translate(arg, compiler, **kwargs))
for arg in op.args
if isinstance(arg, ir.Expr)
Expand Down
1 change: 0 additions & 1 deletion ibis_substrait/tests/compiler/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def test_translate_table_expansion(compiler):
"scalarFunction": {
"functionReference": 1,
"arguments": [
{"enum": {"specified": "ERROR"}},
{
"value": {
"selection": {
Expand Down

0 comments on commit 3266277

Please sign in to comment.