Aaaaaaron commented on a change in pull request #2019:
URL: https://github.com/apache/calcite/pull/2019#discussion_r443140543



##########
File path: core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
##########
@@ -1160,6 +1160,59 @@ public static boolean equalSansNullability(
         factory.createTypeWithNullability(type2, type1.isNullable()));
   }
 
+  /**
+   * Returns whether two array types are equal, ignoring nullability.
+   *
+   * <p>They need not come from the same factory.
+   *
+   * @param factory       Type factory
+   * @param type1         First type
+   * @param type2         Second type
+   * @return Whether types are equal, ignoring nullability
+   */
+  public static boolean equalAsCollectionSansNullability(
+      RelDataTypeFactory factory,
+      RelDataType type1,
+      RelDataType type2) {
+    if (type1.equals(type2)) {
+      return true;
+    }
+
+    if (isCollection(type1) && isCollection(type2)) {
+      return equalSansNullability(factory, type1.getComponentType(), 
type2.getComponentType());

Review comment:
       > we should add assertion instead in the first line: `assert 
isCollection(type1) && isCollection(type2)`
   
   I'll add an assertion. Cuz assert is not enforce in Java, I'll still keep 
the condition in if clause.
   




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to