chunweilei commented on code in PR #2787:
URL: https://github.com/apache/calcite/pull/2787#discussion_r866624468
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -1776,6 +1776,15 @@ protected static Calendar getCalendarNotTooNear(int
timeUnit) {
f.checkNull(" cast(null as ANY) || cast(null as ANY) ");
f.checkString("cast('a' as varchar) || cast('b' as varchar) "
+ "|| cast('c' as varchar)", "abc", "VARCHAR NOT NULL");
+
+ f.checkScalar("array[1, 2] || array[2, 3]", "[1, 2, 2, 3]",
+ "INTEGER NOT NULL ARRAY NOT NULL");
+ f.checkScalar("array[1, 2] || array[2, null]", "[1, 2, 2, null]",
+ "INTEGER ARRAY NOT NULL");
+ f.checkScalar("array['hello', 'world'] || array['!'] || "
+ + "array[cast(null as char)]",
+ "[hello, world, !, null]", "CHAR(5) ARRAY NOT NULL");
Review Comment:
Could you add a test for `array[] || array[]`?
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java:
##########
@@ -248,7 +250,7 @@ public class SqlStdOperatorTable extends
ReflectiveSqlOperatorTable {
public static final SqlInternalOperator EXTEND = new SqlExtendOperator();
/**
- * String concatenation operator, '<code>||</code>'.
+ * String and arrays concatenation operator, '<code>||</code>'.
*
* @see SqlLibraryOperators#CONCAT_FUNCTION
Review Comment:
It would be great if you can specify it only supports `array-to-array
concatenation: ARRAY[1,2,3] || ARRAY[4,5,6]`.
--
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]