You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2022/06/02 01:05:12 UTC

[GitHub] [calcite] wenruimeng commented on a diff in pull request #2823: [CALCITE-5147] Parser configured with BigQuery dialect cannot parse timestamp literal

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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org