wenruimeng commented on code in PR #2823:
URL: https://github.com/apache/calcite/pull/2823#discussion_r887414792
##########
core/src/main/java/org/apache/calcite/sql/parser/SqlParserUtil.java:
##########
@@ -139,38 +139,45 @@ public static java.sql.Timestamp parseTimestamp(String s)
{
return java.sql.Timestamp.valueOf(s);
}
- public static SqlDateLiteral parseDateLiteral(String s, SqlParserPos pos) {
- final String dateStr = parseString(s);
+ public static SqlDateLiteral parseDateLiteralWithoutQuote(String dateStr,
SqlParserPos pos) {
final Calendar cal =
DateTimeUtils.parseDateFormat(dateStr, Format.get().date,
DateTimeUtils.UTC_ZONE);
if (cal == null) {
throw SqlUtil.newContextException(pos,
- RESOURCE.illegalLiteral("DATE", s,
+ RESOURCE.illegalLiteral("DATE", dateStr,
RESOURCE.badFormat(DateTimeUtils.DATE_FORMAT_STRING).str()));
}
final DateString d = DateString.fromCalendarFields(cal);
return SqlLiteral.createDate(d, pos);
}
- public static SqlTimeLiteral parseTimeLiteral(String s, SqlParserPos pos) {
+ public static SqlDateLiteral parseDateLiteral(String s, SqlParserPos pos) {
final String dateStr = parseString(s);
+ return parseDateLiteralWithoutQuote(dateStr, pos);
+ }
+
+ public static SqlTimeLiteral parseTimeLiteralWithoutQuote(String dateStr,
SqlParserPos pos) {
Review Comment:
Good point. Let me change it. I keep it due to it's named as that in
previous code.
--
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]