clintropolis commented on code in PR #16626:
URL: https://github.com/apache/druid/pull/16626#discussion_r1645258412
##########
processing/src/main/java/org/apache/druid/query/expression/ExprUtils.java:
##########
@@ -45,13 +46,23 @@ static DateTimeZone toTimeZone(final Expr timeZoneArg)
}
static PeriodGranularity toPeriodGranularity(
+ final Expr wrappingExpr,
final Expr periodArg,
@Nullable final Expr originArg,
@Nullable final Expr timeZoneArg,
final Expr.ObjectBinding bindings
)
{
- final Period period = new Period(periodArg.eval(bindings).asString());
+ final Period period;
+ try {
+ period = new Period(periodArg.eval(bindings).asString());
+ }
+ catch (IllegalArgumentException iae) {
+ throw InvalidInput.exception(
+ "Invalid period[%s] specified for expression[%s]: [%s]",
+ periodArg.stringify(), wrappingExpr.stringify(), iae.getMessage()
+ );
Review Comment:
nit: format checking robots doesn't catch this always for some reason, but
ideally there should be 1 arg per line when it has to be broken up like this
```suggestion
throw InvalidInput.exception(
"Invalid period[%s] specified for expression[%s]: [%s]",
periodArg.stringify(),
wrappingExpr.stringify(),
iae.getMessage()
);
```
no big deal if you don't want to change it
--
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]