gianm commented on code in PR #15759:
URL: https://github.com/apache/druid/pull/15759#discussion_r1466973698
##########
sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/DateTruncOperatorConversion.java:
##########
@@ -93,14 +93,18 @@ public DruidExpression toDruidExpression(
final Expr truncTypeExpr =
plannerContext.parseExpression(inputExpressions.get(0).getExpression());
if (!truncTypeExpr.isLiteral()) {
- throw new IAE("Operator[%s] truncType must be a literal",
calciteOperator().getName());
+ throw InvalidSqlInput.exception("Operator[%s] truncType must be a
literal", calciteOperator().getName());
Review Comment:
Even better would be to add `.literalOperands(0)` to the operator
conversion. Then it'll be a proper validation error, and we won't need this
check here, because it wouldn't be able to happen.
--
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]