tkalkirill commented on code in PR #5305:
URL: https://github.com/apache/calcite/pull/5305#discussion_r4214595020


##########
core/src/test/resources/sql/row-equality.iq:
##########
@@ -612,4 +612,401 @@ ORDER BY c;
 
 !ok
 
+# Test cases for https://issues.apache.org/jira/browse/CALCITE-7836
+# [CALCITE-7836] Array functions return incorrect results for ROW elements
+# Construct equal rows from separate input columns so constant folding

Review Comment:
   I tried to fix this.



##########
core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java:
##########
@@ -166,6 +166,57 @@ private static void checkArrayRowComparison(Object 
specialRow, Object normalRow,
     assertThat(SqlFunctions.sortArray(new ArrayList<>(rows), false), 
is(list(max, min, null)));
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-7836";>[CALCITE-7836]
+   * Array functions return incorrect results for ROW elements</a>. */
+  @Test void testArrayFunctionsWithRows() {
+    final Object[][] rows = {
+        {1, "Foo"},
+        {null, "Foo"},
+        {new Object[] {1, "Foo"}, 10},
+        {list(new Object[] {1, "Foo"}, new Object[] {2, null}), 10},
+        {Collections.singletonMap("key", new Object[] {1, null}), 10},
+        {-31}, // Deep hash code is zero.
+        {-30} // Deep hash code collides with the replacement for zero.
+    };
+    for (Object[] row : rows) {
+      // Copy the outer row; the nested containers are checked separately 
below.
+      checkArrayFunctionsWithRows(row, row.clone());
+    }
+    checkArrayFunctionsWithRows(new Object[] {new Object[] {1, null}, 10},

Review Comment:
   I tried to fix this.



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