zachjsh commented on code in PR #15836:
URL: https://github.com/apache/druid/pull/15836#discussion_r1483698528
##########
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java:
##########
@@ -200,17 +243,27 @@ public static Granularity
convertSqlNodeToGranularity(SqlNode sqlNode) throws Pa
throw makeInvalidPartitionByException(sqlNode);
}
+ private static Granularity convertSqlLiteralCharToGranularity(SqlLiteral
literal)
+ {
+ try {
+ String value = literal.getValueAs(String.class);
+ return Granularity.fromString(value);
+ }
+ catch (IllegalArgumentException e) {
+ throw makeInvalidPartitionByException(literal);
Review Comment:
I think IAE is only thrown here if the literal is not a valid Granularity,
which the error message returned already includes the literal. so I dont think
that adding the exception to the message is necessary. Let me know if you agree.
--
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]