Xurenhe created CALCITE-4734:
--------------------------------
Summary: Materialization-Failed, when meeting same projs in mv.
Key: CALCITE-4734
URL: https://issues.apache.org/jira/browse/CALCITE-4734
Project: Calcite
Issue Type: Bug
Components: core
Reporter: Xurenhe
Attachments: image-2021-08-13-11-43-54-035.png,
image-2021-08-13-11-44-09-504.png
Some user may define some not beautiful mv, but these mv should be worked for
rewriting query.
For example:
{code:java}
@Test void testMoreSameExprInMv() {
final String mv = ""
+ "select \"empid\", \"deptno\", sum(\"empid\") as s1, sum(\"empid\")
as s2, count(*) as c\n"
+ "from \"emps\" group by \"empid\", \"deptno\"";
final String query = ""
+ "select sum(\"empid\"), count(*) from \"emps\" group by \"empid\",
\"deptno\"";
sql(mv, query).ok();
}
{code}
I try debug code to solve this problem.
I find some bug in
{code:java}
org.apache.calcite.plan.SubstitutionVisitor#getRexShuttle
{code}
!image-2021-08-13-11-43-54-035.png|thumbnail!
!image-2021-08-13-11-44-09-504.png|thumbnail!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)