Comments (8)
This is a good point @jonahgao so this gives me even more confidence to introduce a new DF param which controls should DF go with IEEE 754
from arrow-datafusion.
ERROR: division by zero
I wasn't doubting it. :) But I am surprised.
@comphead I'll take back my 'NULL is not the right thing to return here' comment. It's better than failing for most users.
Just one thing to keep in mind - Spark sql has a isnan
function which should be consistent with this.
from arrow-datafusion.
Surprising that Postgres fails. According to the docs, Infinity, -Infinity, and NaN
are legitimate floating point values. This is also the expected behavior per the ANSI SQL standard, afaik.
NULL
is not the right thing to return here.
from arrow-datafusion.
Postgres fails:
andrewlamb@Andrews-MacBook-Pro-2:~/Software/arrow-rs$ psql -h localhost -U postgres
psql (14.12 (Homebrew), server 16.1 (Debian 16.1-1.pgdg120+1))
WARNING: psql major version 14, server major version 16.
Some psql features might not work.
Type "help" for help.
postgres=# select 1 % -0.0;
ERROR: division by zero
from arrow-datafusion.
I don't have a strong preference one way or the other, personally
from arrow-datafusion.
I don't have a strong preference one way or the other, personally
I would go with Spark/DuckDB way :) if there is no other strong opinions, I'll make a fix soon
from arrow-datafusion.
Thanks @parthchandra for the suggestion, I just checked we should be fine.
scala> spark.sql("select 1 % -0.0").show(false)
+---------+
|(1 % 0.0)|
+---------+
|NULL |
+---------+
scala> spark.sql("select isnan(1 % -0.0)").show(false)
+----------------+
|isnan((1 % 0.0))|
+----------------+
|false |
+----------------+
from arrow-datafusion.
arrow-rs follows the rules of IEEE 754. If we intend to be compatible with other engines, many cases will also need to be modified, such as division by zero.
DataFusion CLI v39.0.0
> select 1.0/0.0;
+-------------------------+
| Float64(1) / Float64(0) |
+-------------------------+
| inf |
+-------------------------+
> select 0.0/0.0;
+-------------------------+
| Float64(0) / Float64(0) |
+-------------------------+
| NaN |
+-------------------------+
In PostgreSQL:
postgres=# select 1.0/0.0;
ERROR: division by zero
postgres=# select 0.0/0.0;
ERROR: division by zero
from arrow-datafusion.
Related Issues (20)
- Add example for writing a `FileFormat` HOT 4
- Add `union_tag` function HOT 1
- Add `union_extract` function HOT 1
- Add more support for ScalarValue::Float16 where Float32 and Float64 are supported HOT 1
- Nullability of array_agg
- Allow casting durations to different timeunits HOT 1
- `gcd` returns negative results HOT 1
- Methods should return `&Arc` references to inner trait objects for `&self` HOT 1
- Excessive number of filters overflows the stack HOT 4
- `LCM` panicked due to overflow
- Running tests uses 50.1GB on Ubuntu HOT 5
- DataFusion weekly project plan (Andrew Lamb) - June 24, 2024 HOT 3
- Make Eq with negative float zero compat with other engines HOT 1
- Support `Decimal` and `Decimal256` Parquet Data Page Statistics HOT 1
- Support `Timestamp` Parquet Data Page Statistics HOT 4
- Support `Date` Parquet Data Page Statistics HOT 1
- Support `Time` Parquet Data Page Statistics HOT 6
- regression: query error with case when as the group field HOT 6
- ScalarValue::new_ten error cites one not ten
- Support Map as a ScalarValue HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arrow-datafusion.