abhishekrb19 commented on code in PR #16626:
URL: https://github.com/apache/druid/pull/16626#discussion_r1644961436
##########
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 timeExpressionArg,
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.eval(bindings).asString(), timeExpressionArg,
iae.getMessage()
Review Comment:
Nice, thanks for the suggestion!
--
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]