caicancai commented on code in PR #3705:
URL: https://github.com/apache/calcite/pull/3705#discussion_r1508483368


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java:
##########
@@ -1375,6 +1376,14 @@ private static void adjustTypeForMultisetConstructor(
       } else {
         elementType = oddType;
       }
+      if (call.getOperator().getName().equals("ARRAY_INSERT") && i == 1) {

Review Comment:
   done



##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -1266,10 +1271,17 @@ private static RelDataType 
arrayInsertReturnType(SqlOperatorBinding opBinding) {
     // we don't need to do leastRestrictive on componentType and elementType,
     // because in operand checker we limit the elementType must equals array 
component type.
     // So we use componentType directly.
-    RelDataType type = componentType;
+    RelDataType type =
+        opBinding.getTypeFactory().leastRestrictive(
+            ImmutableList.of(componentType, elementType));
     if (elementType.isNullable()) {
       type = opBinding.getTypeFactory().createTypeWithNullability(type, true);
     }
+
+    if (componentType != elementType) {

Review Comment:
   done



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