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


##########
core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercionImpl.java:
##########
@@ -563,6 +564,78 @@ protected boolean booleanEquality(SqlCallBinding binding,
     return false;
   }
 
+  /**
+   * {@inheritDoc}
+   *
+   * <p>STRATEGIES
+   *
+   * <p>To determine the common type:
+   *
+   * <ul>
+   *
+   * <li>When the LHS has a Simple type and RHS has a Collection type 
determined by {@link SqlTypeUtil#isCollection},
+   * to find the common type of LHS's type and RHS's component type.
+   * <li>If the common type differs from the LHS type, then coerced LHS type,
+   * and nullable remains unchanged.
+   * <li>Create a new Collection type that matches the common type,
+   * and nullable keep same as RHS's component type and RHS's collection type.
+   * <li>If this new Collection type differs from the RHS type, adjust the RHS 
type as needed.
+   *
+   *<pre>
+   * field1       ARRAY(field2, field3, field4)
+   *    |                |       |       |
+   *    |                +-------+-------+
+   *    |                        |
+   *    |                  component type
+   *    |                        |
+   *    +------common type-------+
+   *</pre>
+   *
+   * <li>Notice: If either LHS or RHS has a {@link SqlTypeName#NULL} type, it 
will directly return without any adjusting.

Review Comment:
   Remove it. The original code logic here has already covered it. If the LHS 
or RHS 's type is null, just return .



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