PaulJackson123 commented on code in PR #3495:
URL: https://github.com/apache/calcite/pull/3495#discussion_r1406907312


##########
core/src/test/java/org/apache/calcite/test/RelMetadataTest.java:
##########
@@ -1211,6 +1211,24 @@ private void 
checkColumnUniquenessForFilterWithConstantColumns(String sql) {
         .assertThatUniqueKeysAre(bitSetOf());
   }
 
+  @Test void testColumnUniquenessForSubqueryWithCorrelatingVars() {
+    final String sql = ""
+        + "select empno, deptno, slacker\n"
+        + "from emp A\n"
+        + "where empno = (\n"
+        + "  select max(empno)\n"
+        + "  from emp B\n"
+        + "  where A.deptno = B.deptno\n"
+        + ")";
+    sql(sql)
+        .assertThatAreColumnsUnique(bitSetOf(0), is(true))
+        // This requires drilling into the subquery
+//        .assertThatAreColumnsUnique(bitSetOf(1), is(true))

Review Comment:
   This test was added to test whether we do not see a scalar subquery as 
constant if it has correlating variables, which it does not, as designed, 
however, for more complex reasons that were not addressed in this PR, `deptno` 
is a unique column.



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