lameyer 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_r314454735
##
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:
Fair - @julianhyde suggested not making a Redshift library until we find
more functions that are specific to Redshift, but I'm also down to make one 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.
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org
With regards,
Apache Git Services