abhishekrb19 commented on code in PR #16626:
URL: https://github.com/apache/druid/pull/16626#discussion_r1644891832
##########
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:
@clintropolis the timestamp expression seems to be slightly gibberish when
the expr is complex. Is there a way to extract the original expression as-is?
For example, with a query like `SELECT TIME_FLOOR(TIMESTAMPADD(DAY, -1,
__time), 'PT1D')`, the time expression is `(+ __time -86400000)`
--
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]