Skip to content

Commit

Permalink
fix(datafusion): cast division inputs to float64 before dividing
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 19, 2023
1 parent d039809 commit 197342d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion ibis/backends/datafusion/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,9 @@ def mul(op, **kw):

@translate.register(ops.Divide)
def div(op, **kw):
return translate(op.left, **kw) / translate(op.right, **kw)
left = translate(ops.Cast(op.left, to=dt.float64), **kw)
right = translate(ops.Cast(op.right, to=dt.float64), **kw)
return left / right


@translate.register(ops.FloorDivide)
Expand Down
4 changes: 1 addition & 3 deletions ibis/backends/tests/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,9 +1261,7 @@ def test_floating_mod(backend, alltypes, df):
),
],
)
@pytest.mark.notyet(
["datafusion", "duckdb", "mysql", "pyspark", "sqlite"], raises=AssertionError
)
@pytest.mark.notyet(["duckdb", "mysql", "pyspark", "sqlite"], raises=AssertionError)
@pytest.mark.notyet(["mssql"], raises=sa.exc.OperationalError)
@pytest.mark.notyet(["postgres"], raises=sa.exc.DataError)
@pytest.mark.notyet(["snowflake"], raises=sa.exc.ProgrammingError)
Expand Down

1 comment on commit 197342d

@ibis-squawk-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 3.

Benchmark suite Current: 197342d Previous: b37804a Ratio
ibis/tests/benchmarks/test_benchmarks.py::test_compile_with_drops[trino] 2.836918160494826 iter/sec (stddev: 2.006445921354214) 92.17620391711 iter/sec (stddev: 0.009681438589982187) 32.49

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.