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/07 04:50:35 UTC

[GitHub] [druid] clintropolis commented on a change in pull request #11409: Better error message for unsupported double values

clintropolis commented on a change in pull request #11409:
URL: https://github.com/apache/druid/pull/11409#discussion_r665037572



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRexExecutor.java
##########
@@ -126,6 +126,15 @@ 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) || Double.isInfinite(exprResultDouble)) {
+                String expression = druidExpression.getExpression();
+                throw new IAE("'%s' evaluates to '%s' 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:
       i wonder if it is worth clarify that the not supported part is specific to SQL




-- 
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