Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.28.0
Description
When I convert the following RelNode to SQL(with CalciteSqlDialect) in ToLogicalConverterTest.java:
@Test void testIntersect() { final RelBuilder builder = builder(); RelNode rel = builder.scan("DEPT") .project(builder.field("DEPTNO")) .scan("EMP") .project(builder.field("DEPTNO")) .intersect(true) .limit(0, 2) .build(); System.out.println(new RelToSqlConverter(SqlDialect.DatabaseProduct.CALCITE.getDialect()).visitRoot(rel).asStatement());
I get:
SELECT * FROM SELECT `DEPTNO` FROM `scott`.`DEPT` INTERSECT ALL SELECT `DEPTNO` FROM `scott`.`EMP` FETCH NEXT 2 ROWS ONLY
But the expected SQL should be:
SELECT * FROM (SELECT `DEPTNO` FROM `scott`.`DEPT` INTERSECT ALL SELECT `DEPTNO` FROM `scott`.`EMP`) FETCH NEXT 2 ROWS ONLY
Other SetOperators like UNION、MINUS can be converted correctly.
Attachments
Issue Links
- links to