Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
In current code of FilterToProjectUnifyRule::invert(https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java#L1124), the implementation
1. Fails the matching when there is Non-RexInputRef in the projects
2. Didn't check if all items of exprList has already been set correctly.
As a result below tests fails.
@Test public void testFilterToProject0() { String union = "select * from \"emps\" where \"empid\" > 300\n" + "union all select * from \"emps\" where \"empid\" < 200"; String mv = "select *, \"empid\" * 2 from (" + union + ")"; String query = "select * from (" + union + ") where (\"empid\" * 2) > 3"; checkMaterialize(mv, query); } @Test public void testFilterToProject1() { String agg = "select \"deptno\", count(*) as \"c\", sum(\"salary\") as \"s\"\n" + "from \"emps\" group by \"deptno\""; String mv = "select \"c\", \"s\", \"s\" from (" + agg + ")"; String query = "select * from (" + agg + ") where (\"s\" * 0.8) > 10000"; checkNoMaterialize(mv, query, HR_FKUK_MODEL); }
Attachments
Issue Links
- links to