在 Flink SQL 中除 const 整数时出现 ArithmeticException
ArithmeticException when divide const integer in Flink SQL
当我执行以下查询时,Flink 抛出 ArithmeticException(终止小数扩展时没有可精确表示的小数结果):
SELECT productId, COUNT(order), COUNT(order)/100.0
From product
GROUP BY productId
我无法从文档或 google 中找到解决此问题的方法。
谢谢
该异常将在即将发布的 Flink 1.5 版本中修复。它被描述为 in this issue。作为解决方法,您可以简单地转换为双精度 CAST(x AS DOUBLE)
。只有 Java 的 BigDecimal
类型 (SQL DECIMAL
) 的算术受到影响。
当我执行以下查询时,Flink 抛出 ArithmeticException(终止小数扩展时没有可精确表示的小数结果):
SELECT productId, COUNT(order), COUNT(order)/100.0
From product
GROUP BY productId
我无法从文档或 google 中找到解决此问题的方法。 谢谢
该异常将在即将发布的 Flink 1.5 版本中修复。它被描述为 in this issue。作为解决方法,您可以简单地转换为双精度 CAST(x AS DOUBLE)
。只有 Java 的 BigDecimal
类型 (SQL DECIMAL
) 的算术受到影响。