imply-cheddar commented on code in PR #14004:
URL: https://github.com/apache/druid/pull/14004#discussion_r1226108265


##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRexExecutor.java:
##########
@@ -125,12 +126,12 @@ public void reduce(
               // the query can execute.
               double exprResultDouble = exprResult.asDouble();
               if (Double.isNaN(exprResultDouble) || 
Double.isInfinite(exprResultDouble)) {
-                String expression = druidExpression.getExpression();
-                throw new UnsupportedSQLQueryException("'%s' evaluates to '%s' 
that is not supported in SQL. You can either cast the expression as BIGINT 
('CAST(%s as BIGINT)') or VARCHAR ('CAST(%s as VARCHAR)') or change the 
expression itself",
-                    expression,
-                    Double.toString(exprResultDouble),
-                    expression,
-                    expression);
+                throw InvalidSqlInput.exception(
+                        "Expression [%s] evaluates to an unsupported value 
[%s], expected something that"
+                        + " can be a Double.  Consider casting with 
'CAST(<col> AS BIGINT)'",
+                        druidExpression.getExpression(),
+                        exprResultDouble
+                    );

Review Comment:
   I took it as the expression has a return type and that return type isn't 
matching the input of another expression or something like that.  Which is why 
it had the suggestion to cast...  But, I was mostly just keeping what was in 
existence around rather than creating anything new.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to