chucheng92 commented on code in PR #3320:
URL: https://github.com/apache/calcite/pull/3320#discussion_r1283285678
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -4107,6 +4113,97 @@ public static List arrayExcept(List list1, List list2) {
return new ArrayList<>(result);
}
+ /** Support the ARRAY_INSERT(array, pos, val) function. */
+ public static @Nullable List arrayInsert(List baselist, Object pos, Object
val) {
Review Comment:
another case, if second pos is a null value. e.g. array_insert(array(1,2,3),
cast(null as Integer), 2), then searched method is `arrayInsert[interface
java.util.List, Integer, int]`. We want to use `Integer` to cover `int and
Integer`, but it can't be worked. There are currently many functions that have
this behavior. e.g. array_repeat
SqlFunctions#repeat
```
// the second operand type is Integer
List<Object> repeat(Object element, Object count)
```
see
https://github.com/apache/calcite/blob/ffd58e3b6d3824e141d76cbbc3664608e8d1bb4d/core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java#L4267C7-L4267C7
--
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]