如何在 apache drill query where 子句中使用算术运算符?

How to use arithmetic operators in apache drill query where clause?

我正在尝试使用 Apache Drill 查询镶木地板文件。我想对值进行排序并获得 FloatCol1 的最大值。所以下面的查询有效。

select * from dfs.tmp.`tmp.parquet` order by FloatCol1 desc limit 1;

我还有另一列 FloatCol2,我想使用 FloatCol1/FloatCol2 的比率再次排序。所以我做了以下查询来尝试哪个会起作用但是 NONE 做到了。

select * from dfs.tmp.`tmp.parquet` order by (FloatCol1/FloatCol2) desc limit 1;
select * from dfs.tmp.`tmp.parquet` order by (FloatCol1/FloatCol2) as ratio desc limit 1;
select * from dfs.tmp.`tmp.parquet` order by FloatCol1/FloatCol2 desc limit 1;

这种查询可以吗?如果是,如何?

知道了。我只需要像这样

select * from dfs.tmp.`tmp.parquet` order by cast(FloatCol1 as decimal(28, 2))/cast(FloatCol2 as decimal(28, 2)) desc limit 1;

我必须在应用运算符之前转换每个单独的值。