YiwenWu commented on code in PR #3792: URL: https://github.com/apache/calcite/pull/3792#discussion_r1615414017
########## core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java: ########## @@ -1651,13 +1652,22 @@ private static RelDataType deriveTypeMapFromEntries(SqlOperatorBinding opBinding * * <p>({@code TO_CHAR} is not supported in MySQL, but it is supported in * MariaDB, a variant of MySQL covered by {@link SqlLibrary#MYSQL}.) */ - @LibraryOperator(libraries = {MYSQL, ORACLE, POSTGRESQL}) + @LibraryOperator(libraries = {MYSQL, ORACLE}) public static final SqlFunction TO_CHAR = SqlBasicFunction.create("TO_CHAR", - ReturnTypes.VARCHAR, + ReturnTypes.VARCHAR_NULLABLE, OperandTypes.TIMESTAMP_STRING, SqlFunctionCategory.TIMEDATE); + /** The "TO_CHAR(timestamp, format)" function; + * converts {@code timestamp} to string according to the given {@code format}. */ + @LibraryOperator(libraries = {POSTGRESQL}) + public static final SqlFunction TO_CHAR_PG = + new SqlBasicFunction("TO_CHAR", SqlKind.OTHER_FUNCTION, Review Comment: Understood. A small suggestion, I think the `SqlBasicFunction` constructor is designed to be as private as possible. Is it possible to add a create method to create the corresponding anonymous class, for example: ``` public static SqlBasicFunction overloadCreate(String name, SqlReturnTypeInference returnTypeInference, SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory category) { return new SqlBasicFunction(name, SqlKind.OTHER_FUNCTION, SqlSyntax.FUNCTION, true, returnTypeInference, null, OperandHandlers.DEFAULT, operandTypeChecker, 0, category, call -> SqlMonotonicity.NOT_MONOTONIC, false){}; } ``` -- 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-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org