YiwenWu commented on code in PR #3684:
URL: https://github.com/apache/calcite/pull/3684#discussion_r1493743738
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -1074,6 +1080,26 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding
operatorBinding,
.withOperandTypeInference(InferTypes.RETURN_TYPE)
.withKind(SqlKind.CONCAT_WS_MSSQL);
+ /** The "CONCAT_WS(separator[, str | array(str)]+)" function in (SPARK).
+ *
+ * <p>Differs from {@link #CONCAT_WS} (MySQL, Postgres) in that it accepts
+ * 1 arguments
+ *
+ * <ul>
+ * <li>{@code CONCAT_WS(',', 'a', 'b')} returns "{@code a,b}";
+ * <li>{@code CONCAT_WS(null, 'a', 'b')} returns NULL";
+ * <li>{@code CONCAT_WS('s')} returns "";
+ * <li>{@code CONCAT_WS('/', 'a', null, 'b')} returns "{@code a/b}".
+ * </ul> */
+ @LibraryOperator(libraries = {SPARK})
+ public static final SqlFunction CONCAT_WS_SPARK =
+ SqlBasicFunction.create("CONCAT_WS",
+
ReturnTypes.MULTIVALENT_STRING_WITH_SEP_SUM_PRECISION_ARG0_NULLABLE,
Review Comment:
done, add array case
--
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]