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



##########
File path: core/src/test/java/org/apache/calcite/sql/type/SqlTypeUtilTest.java
##########
@@ -117,6 +120,47 @@
     SqlTypeCoercionRule.THREAD_PROVIDERS.set(defaultRules);
   }
 
+  @Test void testEqualAsCollectionSansNullability() {
+    final SqlTypeFactoryImpl factory =
+        new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+    final RelDataType bigint = factory.createSqlType(SqlTypeName.BIGINT);
+
+    // case array
+    final RelDataType arrayNullable =
+        new ArraySqlType(factory.createTypeWithNullability(bigint, true), 
false);
+    final RelDataType arrayNotNull =
+        new ArraySqlType(factory.createTypeWithNullability(bigint, false), 
false);
+    assertThat(equalAsCollectionSansNullability(factory, arrayNullable, 
arrayNotNull),
+        is(true));
+
+    // case multiset
+    final RelDataType setNullable =
+        new MultisetSqlType(factory.createTypeWithNullability(bigint, true), 
false);
+    final RelDataType setNotNull =
+        new MultisetSqlType(factory.createTypeWithNullability(bigint, false), 
false);
+    assertThat(equalAsCollectionSansNullability(factory, setNullable, 
setNotNull),
+        is(true));
+
+    // multiset and array are not equal.
+    assertThat(equalAsCollectionSansNullability(factory, arrayNotNull, 
setNotNull),
+        is(false));
+  }
+
+  @Test void testEqualAsMapSansNullability() {
+    final SqlTypeFactoryImpl factory =
+        new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+    final RelDataType bigint = factory.createSqlType(SqlTypeName.BIGINT);

Review comment:
       > Use type from `SqlTypeFixture` if possible.
   
   The basic type is replaced, but nested type in SqlTypeFixture does not meet 
the requirements(map type/nullability), should I add these to SqlTypeFixture? 
Or just leave them in this ut.




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