NobiGo commented on code in PR #3846:
URL: https://github.com/apache/calcite/pull/3846#discussion_r1667851711


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -1089,6 +1090,25 @@ static RelDataType deriveTypeSplit(SqlOperatorBinding 
operatorBinding,
           SqlFunctionCategory.STRING)
           .withOperandTypeInference(InferTypes.RETURN_TYPE);
 
+  /** The "CONCAT_WS(separator, arg1, ...)" function (Postgres).
+   *
+   * <p>Differs from {@link #CONCAT_WS} (MySQL) in that its arg1 can be of any 
type,
+   * not limited to string. For example:
+   *
+   * <ul>
+   * <li>{@code CONCAT_WS(',', 'a')} returns "{@code a}";

Review Comment:
   I test SQL in SparkSQL, It is all output as the doc. PostgreSQL and SparkSQL 
still have the differrent behavior in CONCAT_WS?
   ```
   spark-sql> select concat_ws(',',ARRAY(10000, 10000, 10000, 10000));
   10000,10000,10000,10000
   Time taken: 1.133 seconds, Fetched 1 row(s)
   spark-sql> select CONCAT_WS(',', 'a', DATE '1945-02-24');
   a,1945-02-24
   Time taken: 0.072 seconds, Fetched 1 row(s)
   spark-sql> select  CONCAT_WS(',', 'a',ARRAY('b', 'c'));
   a,b,c
   Time taken: 0.066 seconds, Fetched 1 row(s)
   ```



-- 
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]

Reply via email to