danny0405 commented on a change in pull request #1380: [CALCITE-3252] Syntax 
error while parsing CONVERT_TIMEZONE, TO_DATE, TO_TIMESTAMP functions on 
Redshift
URL: https://github.com/apache/calcite/pull/1380#discussion_r314158337
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java
 ##########
 @@ -171,6 +171,44 @@ private SqlLibraryOperators() {
           ReturnTypes.VARCHAR_2000, null, OperandTypes.DATETIME,
           SqlFunctionCategory.TIMEDATE);
 
+  /** The "TO_DATE(string1, string2)" function; casts string1
+   * to a date using the format specified in string2 */
+  @LibraryOperator(libraries = {POSTGRESQL, ORACLE})
+  public static final SqlFunction TO_DATE =
+      new SqlFunction(
+          "TO_DATE",
+          SqlKind.OTHER_FUNCTION,
+          ReturnTypes.DATE_NULLABLE,
+          null,
+          OperandTypes.STRING_STRING,
+          SqlFunctionCategory.TIMEDATE);
+
+  /** The "TO_TIMESTAMP(string1, string2)" function; casts string1
+   * to a timestamp using the format specified in string2 */
+  @LibraryOperator(libraries = {POSTGRESQL, ORACLE})
+  public static final SqlFunction TO_TIMESTAMP =
+      new SqlFunction(
+          "TO_TIMESTAMP",
+          SqlKind.OTHER_FUNCTION,
+          ReturnTypes.DATE_NULLABLE,
+          null,
+          OperandTypes.STRING_STRING,
+          SqlFunctionCategory.TIMEDATE);
+
+  /** The "CONVERT_TIMEZONE(string1, string2, datetime)" function;
+   * converts the timezone of the datetime from string1 to string2.
+   * This function is only on Redshift, but we list it in Postgresql
+   * because Redshift does not have its own library. */
 
 Review comment:
   Then add a `Redshift` library ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to