You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/07/05 11:49:13 UTC
[GitHub] [druid] abhishekagarwal87 commented on a change in pull request #11409: Better error message for unsupported double values
abhishekagarwal87 commented on a change in pull request #11409:
URL: https://github.com/apache/druid/pull/11409#discussion_r663869282
##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRexExecutor.java
##########
@@ -126,6 +126,23 @@ public void reduce(
// if exprResult evaluates to Nan or infinity, this will throw a NumberFormatException.
// If you find yourself in such a position, consider casting the literal to a BIGINT so that
// the query can execute.
+ double exprResultDouble = exprResult.asDouble();
+ if (Double.isNaN(exprResultDouble))
+ {
+ String expression = druidExpression.getExpression();
+ throw new IAE("'%s' evaluates to 'NaN' that is not supported. You can either cast the expression as bigint ('cast(%s as bigint)') or char ('cast(%s as char)') or change the expression itself",
Review comment:
wondering if using a `NumberFormatException` instead of `IAE` makes more sense here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org