somu-imply commented on code in PR #14510:
URL: https://github.com/apache/druid/pull/14510#discussion_r1272821692
##########
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java:
##########
@@ -566,14 +571,28 @@ public static String parseColumnName(SqlNode sqlNode)
* @return the timestamp string as milliseconds from epoch
* @throws DruidException if the SQL node is not a SqlTimestampLiteral
*/
- private static String parseTimeStampWithTimeZone(SqlNode sqlNode,
DateTimeZone timeZone)
+ static String parseTimeStampWithTimeZone(SqlNode sqlNode, DateTimeZone
timeZone)
{
+ Timestamp sqlTimestamp;
+ ZonedDateTime zonedTimestamp;
+
+ if (sqlNode instanceof SqlUnknownLiteral) {
+ try {
+ SqlTimestampLiteral timestampLiteral = (SqlTimestampLiteral)
((SqlUnknownLiteral) sqlNode).resolve(SqlTypeName.TIMESTAMP);
+ sqlTimestamp = Timestamp.valueOf(timestampLiteral.toFormattedString());
+ }
+ catch (Exception e) {
+ throw InvalidSqlInput.exception("Cannot get a timestamp from sql
expression [%s]", sqlNode);
Review Comment:
I'll add an unit test for this
--
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]