Apache Drill SQL:分子 > 分母时除法失败

Apache Drill SQL: Division fails when numerator > denominator

我遇到了 apache-drill 这个奇怪但基本的问题 SQL,一个简单的除法操作给出了错误的结果,如下所示:

0: jdbc:drill:drillbit=localhost> SELECT 'Test' FROM (VALUES(1));
+---------+
| EXPR[=11=]  |
+---------+
| Test    |
+---------+
1 row selected (1.027 seconds)
0: jdbc:drill:drillbit=localhost> select 10/100 from (VALUES(1));
+---------+
| EXPR[=11=]  |
+---------+
| 0       |
+---------+
1 row selected (0.67 seconds)
0: jdbc:drill:drillbit=localhost> select 100/10 from (VALUES(1));
+---------+
| EXPR[=11=]  |
+---------+
| 10      |
+---------+
1 row selected (0.662 seconds)
0: jdbc:drill:drillbit=localhost> select 10/11 from (VALUES(1));
+---------+
| EXPR[=11=]  |
+---------+
| 0       |
+---------+
1 row selected (0.649 seconds)
0: jdbc:drill:drillbit=localhost> select cast(10/11 as float) from (VALUES(1));
+---------+
| EXPR[=11=]  |
+---------+
| 0.0     |
+---------+
1 row selected (0.74 seconds)
0: jdbc:drill:drillbit=localhost> select cast(10/11 as double) from (VALUES(1));
+---------+
| EXPR[=11=]  |
+---------+
| 0.0     |
+---------+
1 row selected (0.691 seconds)
0: jdbc:drill:drillbit=localhost> select cast(10*100/11 as double) from (VALUES(1));
+---------+
| EXPR[=11=]  |
+---------+
| 90.0    |
+---------+
1 row selected (0.72 seconds)
0: jdbc:drill:drillbit=localhost> select cast(10*100/11 as double)/100 from (VALUES(1));
+---------+
| EXPR[=11=]  |
+---------+
| 0.9     |
+---------+

Drill 版本是 1.6 和 1.8(都试过了)。即使 round 也无济于事。有什么解决办法吗?

这是整数运算。
11/4 = 2(和提醒 = 3)

您必须将其中一个值转换为请求的类型。

select cast(x as float)/y