JingDas commented on code in PR #3264:
URL: https://github.com/apache/calcite/pull/3264#discussion_r1233327411
##########
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() {
Review Comment:
Add testForeignKeysFilter and testForeignKeysFilterEmpty case.
--
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]