asolimando commented on code in PR #3264:
URL: https://github.com/apache/calcite/pull/3264#discussion_r1229997303


##########
core/src/test/java/org/apache/calcite/test/RelMetadataTest.java:
##########
@@ -273,6 +273,104 @@ final RelMetadataFixture sql(String sql) {
                 / (DEPT_SIZE + EMP_SIZE)));
   }
 
+  // ----------------------------------------------------------------------
+  // Tests for getForeignKeys
+  // ----------------------------------------------------------------------
+
+  @Test void testForeignKeysAggregateCallEmpty() {
+    sql("select hiredate, sum(sal) from emp group by hiredate")
+        .assertForeignKeysAreEmpty();
+  }
+
+  @Test void testForeignKeysAggregateKeyEmpty() {
+    sql("select hiredate, sum(sal) from emp group by hiredate")
+        .assertForeignKeysAreEmpty();
+  }
+
+  @Test void testForeignKeysAggregateKey() {
+    sql("select count(sal), deptno from emp group by deptno")
+        .assertForeignKeys(equalTo(bitSetOf(1)));
+  }
+
+  @Test void testForeignKeysTableOnly() {
+    sql("select deptno, ename from emp")
+        .assertForeignKeys(equalTo(bitSetOf(0)));
+  }
+
+  @Test void testForeignKeysTableOnlyEmpty() {
+    sql("select ename, job from emp")
+        .assertForeignKeysAreEmpty();
+  }
+
+  @Test void testForeignKeysExpressionEmpty() {
+    sql("select deptno + 1, ename from emp")
+        .assertForeignKeysAreEmpty();
+  }
+
+  @Test void testForeignKeysFilter() {
+    sql("select deptno, ename from emp where ename = 'lucy'")
+        .assertForeignKeys(equalTo(bitSetOf(0)));
+  }
+
+  @Test void testForeignKeysInnerJoinLeft() {
+    sql("select emp.deptno, dept.name, emp.deptno from emp, dept")
+        .assertForeignKeys(equalTo(bitSetOf(0, 2)));
+  }
+
+  @Test void testForeignKeysInnerJoinRight() {
+    sql("select dept.name, emp.deptno, emp.deptno from dept, emp")
+        .assertForeignKeys(equalTo(bitSetOf(1, 2)));
+  }
+
+  @Test void testForeignKeysJoinLeftOuter() {

Review Comment:
   ```suggestion
     @Test void testForeignKeysLeftOuterJoin() {
   ```



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