normanj-bitquill commented on code in PR #3801:
URL: https://github.com/apache/calcite/pull/3801#discussion_r1687154924
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -563,11 +563,86 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding
operatorBinding,
OperandTypes.STRING_STRING_OPTIONAL_INTEGER_OPTIONAL_INTEGER_OPTIONAL_INTEGER,
SqlFunctionCategory.STRING);
- /** The "REGEXP_REPLACE(value, regexp, rep [, pos [, occurrence [,
matchType]]])"
+ /** The "REGEXP_REPLACE(value, regexp)"
* function. Replaces all substrings of value that match regexp with
* {@code rep} and returns modified value. */
- @LibraryOperator(libraries = {BIG_QUERY, MYSQL, ORACLE, REDSHIFT})
- public static final SqlFunction REGEXP_REPLACE = new
SqlRegexpReplaceFunction();
+ @LibraryOperator(libraries = {POSTGRESQL})
+ public static final SqlFunction REGEXP_REPLACE_2 =
+ new SqlBasicFunction("REGEXP_REPLACE", SqlKind.OTHER_FUNCTION,
+ SqlSyntax.FUNCTION, true, ReturnTypes.VARCHAR_NULLABLE, null,
+ OperandHandlers.DEFAULT, OperandTypes.STRING_STRING, 0,
+ SqlFunctionCategory.STRING, call -> SqlMonotonicity.NOT_MONOTONIC,
false) { };
+
+ /** The "REGEXP_REPLACE(value, regexp, rep)"
+ * function. Replaces all substrings of value that match regexp with
+ * {@code rep} and returns modified value. */
+ @LibraryOperator(libraries = {MYSQL, ORACLE, REDSHIFT})
+ public static final SqlFunction REGEXP_REPLACE_3 =
+ SqlBasicFunction.create("REGEXP_REPLACE", ReturnTypes.VARCHAR_NULLABLE,
+ OperandTypes.STRING_STRING_STRING, SqlFunctionCategory.STRING);
+
+ /** The "REGEXP_REPLACE(value, regexp, rep, pos)"
+ * function. Replaces all substrings of value that match regexp with
+ * {@code rep} and returns modified value. */
+ @LibraryOperator(libraries = {MYSQL, ORACLE, REDSHIFT})
+ public static final SqlFunction REGEXP_REPLACE_4 =
+ new SqlBasicFunction("REGEXP_REPLACE", SqlKind.OTHER_FUNCTION,
+ SqlSyntax.FUNCTION, true, ReturnTypes.VARCHAR_NULLABLE, null,
+ OperandHandlers.DEFAULT, OperandTypes.family(SqlTypeFamily.STRING,
SqlTypeFamily.STRING,
+ SqlTypeFamily.STRING, SqlTypeFamily.INTEGER),
+ 0, SqlFunctionCategory.STRING, call ->
SqlMonotonicity.NOT_MONOTONIC, false) { };
+
+ /** The "REGEXP_REPLACE(value, regexp, rep, pos, occurrence)"
+ * function. Replaces all substrings of value that match regexp with
Review Comment:
Added comments for each of the arguments.
--
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]