You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
A clear and concise description of issue.
Is the current way of handling "division by zero calculation" reasonable?
current solution:
public ❯ select 1/0;
+---------------------+
| Int64(1) / Int64(0) |
+---------------------+
| |
+---------------------+
Query took 0.031 seconds.
public ❯ select 1+1;
+---------------------+
| Int64(1) + Int64(1) |
+---------------------+
| 2 |
+---------------------+
Query took 0.007 seconds.
public ❯ select 10/(1-1);
+---------------------------------+
| Int64(10) / Int64(1) - Int64(1) |
+---------------------------------+
| |
+---------------------------------+
Query took 0.004 seconds.
public ❯ select 10/(1-1.0);
+-----------------------------------+
| Int64(10) / Int64(1) - Float64(1) |
+-----------------------------------+
| |
+-----------------------------------+
Query took 0.007 seconds.
public ❯ create table tb1(f0 bigint, f1 bigint, tags(t1));
Query took 0.009 seconds.
public ❯ insert into tb1(time, t0, f0, f1)value(now(), 't1', 1, 0);
422 Unprocessable Entity, details: {"error_code":"010009","error_message":"sql parser error: Expected SELECT, VALUES, or a subquery in the query body, found: value"}
public ❯ insert into tb1(time, t0, f0, f1)values(now(), 't1', 1, 0);
422 Unprocessable Entity, details: {"error_code":"010044","error_message":"Semantic error: Insert column 't0' does not exist in target table, expect time,t1,f0,f1"}
public ❯ insert into tb1(time, t1, f0, f1)values(now(), 't1', 1, 0);
+------+
| rows |
+------+
| 1 |
+------+
Query took 0.029 seconds.
public ❯ select * from tb1;
+----------------------------+----+----+----+
| time | t1 | f0 | f1 |
+----------------------------+----+----+----+
| 2024-01-25T10:03:38.031529 | t1 | 1 | 0 |
+----------------------------+----+----+----+
Query took 0.006 seconds.
public ❯ select f0/f1 from tb1;
+-----------------+
| tb1.f0 / tb1.f1 |
+-----------------+
| |
+-----------------+
Query took 0.004 seconds.
public ❯ select f1/f0 from tb1;
+-----------------+
| tb1.f1 / tb1.f0 |
+-----------------+
| 0 |
+-----------------+
Query took 0.003 seconds.
public ❯ select now(), f1, 1, 1 from tb1;
422 Unprocessable Entity, details: {"error_code":"010001","error_message":"Datafusion: Error during planning: Projections require unique expression names but the expression \"Int64(1)\" at position 2 and \"Int64(1)\" at position 3 have the same name. Consider aliasing (\"AS\") one of them."}
public ❯ select now(), f1, 1 from tb1;
+-----------------------------+----+----------+
| now() | f1 | Int64(1) |
+-----------------------------+----+----------+
| 2024-01-25T10:09:42.811251Z | 0 | 1 |
+-----------------------------+----+----------+
Query took 0.003 seconds.
public ❯ select 1/0, 1 from tb1;
+---------------------+----------+
| Int64(1) / Int64(0) | Int64(1) |
+---------------------+----------+
| | 1 |
+---------------------+----------+
Query took 0.003 seconds.
public ❯ select 1/0, 1;
+---------------------+----------+
| Int64(1) / Int64(0) | Int64(1) |
+---------------------+----------+
| | 1 |
+---------------------+----------+
Query took 0.002 seconds.
public ❯ insert into tb1(time, t1, f0, f1)values(now(), 't1', 0, 1);
+------+
| rows |
+------+
| 1 |
+------+
Query took 0.005 seconds.
public ❯ select f1/f0 from tb1;
+-----------------+
| tb1.f1 / tb1.f0 |
+-----------------+
| 0 |
| |
+-----------------+
Query took 0.002 seconds.
public ❯ select f1/f0 from tb1;
+-----------------+
| tb1.f1 / tb1.f0 |
+-----------------+
| 0 |
| |
+-----------------+
Query took 0.002 seconds.
public ❯ select f1/f0 from tb1;
+-----------------+
| tb1.f1 / tb1.f0 |
+-----------------+
| 0 |
| |
+-----------------+
Query took 0.003 seconds.
public ❯ select f1/f0 from tb1;
+-----------------+
| tb1.f1 / tb1.f0 |
+-----------------+
| 0 |
| |
+-----------------+
Query took 0.003 seconds.
public ❯ select f1/f0 from tb1;
+-----------------+
| tb1.f1 / tb1.f0 |
+-----------------+
| 0 |
| |
+-----------------+
Query took 0.002 seconds.
Describe the issue
A clear and concise description of issue.
Is the current way of handling "division by zero calculation" reasonable?
current solution:
PG solution:
mysql solution:
What you like us to do
Please give us some advices
Additional context
Add any other context about the issue here.
The text was updated successfully, but these errors were encountered: