danny0405 commented on a change in pull request #1534: [CALCITE-3450] Support
Intersect and Minus in RelMdTableReferences.
URL: https://github.com/apache/calcite/pull/1534#discussion_r339413357
##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -2229,6 +2229,34 @@ private void checkAllPredicates(RelOptCluster cluster,
RelOptTable empTable,
+ "[CATALOG, SALES, EMP].#2, [CATALOG, SALES, EMP].#3]"));
}
+ @Test public void testTableReferenceForIntersect() {
+ final String sql1 = "select a.deptno, a.sal from emp a\n"
+ + "intersect all select b.deptno, b.sal from emp b where empno =
5";
+ final RelNode rel1 = convertSql(sql1);
+ final RelMetadataQuery mq1 = rel1.getCluster().getMetadataQuery();
+ final Set<RelTableRef> tableReferences1 =
Sets.newTreeSet(mq1.getTableReferences(rel1));
+ assertThat(tableReferences1.toString(),
+ equalTo("[[CATALOG, SALES, EMP].#0, [CATALOG, SALES, EMP].#1]"));
+
+ final String sql2 = "select a.deptno from dept a intersect all select
b.deptno from emp b";
+ final RelNode rel2 = convertSql(sql2);
+ final RelMetadataQuery mq2 = rel2.getCluster().getMetadataQuery();
+ final Set<RelTableRef> tableReferences2 =
Sets.newTreeSet(mq2.getTableReferences(rel2));
+ assertThat(tableReferences2.toString(),
+ equalTo("[[CATALOG, SALES, DEPT].#0, [CATALOG, SALES, EMP].#0]"));
+
+ }
+
+ @Test public void testTableReferenceForMinux() {
+ final String sql = "select emp.deptno, emp.sal from emp\n"
Review comment:
`testTableReferenceForMinus` ?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services