[ https://issues.apache.org/jira/browse/CALCITE-3626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
xzh_dz updated CALCITE-3626: ---------------------------- Description: when i run those codes as below, i get some error messages.it seems like materialized view can not be matched correctly. code: {code:java} @Test public void testSort0() { String mv = "select \"deptno\", \"commission\" from \"emps\" order by \"deptno\""; String query = "select \"deptno\" , \"commission\" from \"emps\" order by \"commission\""; checkMaterialize(mv, query, true); } {code} {code:java} @Test public void testSort1() { String mv = "select \"deptno\", \"commission\" from \"emps\" order by \"deptno\""; String query = "select \"commission\", \"deptno\" from \"emps\" order by \"commission\""; checkMaterialize(mv, query, true); } {code} exception: java.lang.AssertionError: Expected: a string containing "EnumerableTableScan(table=[[hr, m0]])" but: was "PLAN=EnumerableSort(sort0=[$0], dir0=[ASC])\n EnumerableCalc(expr#0..4=[{inputs}], commission=[$t4], deptno=[$t1])\n EnumerableTableScan(table=[[hr, emps]])\n\n" <Click to see difference> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6) at org.apache.calcite.test.CalciteAssert.lambda$checkResultContains$7(CalciteAssert.java:429) at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:544) at org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1514) at org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1446) was: when i run those codes as below, i get some error messages.it seems like materialized view can not be matched correctly. ``` @Test public void testSort0() { String mv = "select \"deptno\", \"commission\" from \"emps\" order by \"deptno\""; String query = "select \"deptno\" , \"commission\" from \"emps\" order by \"commission\""; checkMaterialize(mv, query, true); } ``` ``` @Test public void testSort1() { String mv = "select \"deptno\", \"commission\" from \"emps\" order by \"deptno\""; String query = "select \"commission\", \"deptno\" from \"emps\" order by \"commission\""; checkMaterialize(mv, query, true); } ``` exception: java.lang.AssertionError: java.lang.AssertionError: Expected: a string containing "EnumerableTableScan(table=[[hr, m0]])" but: was "PLAN=EnumerableSort(sort0=[$0], dir0=[ASC])\n EnumerableCalc(expr#0..4=[ {inputs} ], commission=[$t4], deptno=[$t1])\n EnumerableTableScan(table=[[hr, emps]])\n\n"<Click to see difference> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6) at org.apache.calcite.test.CalciteAssert.lambda$checkResultContains$7(CalciteAssert.java:429) at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:544) at org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1514) at org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1446) at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1512) at org.apache.calcite.test.CalciteAssert$AssertQuery.explainMatches(CalciteAssert.java:1609) at org.apache.calcite.test.MaterializationTest.checkThatMaterialize(MaterializationTest.java:279) at org.apache.calcite.test.MaterializationTest.checkMaterialize(MaterializationTest.java:239) at org.apache.calcite.test.MaterializationTest.checkMaterialize(MaterializationTest.java:215) at org.apache.calcite.test.MaterializationTest.testSort1(MaterializationTest.java:653) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at > Can't apply materialized view with a simple sort > ------------------------------------------------ > > Key: CALCITE-3626 > URL: https://issues.apache.org/jira/browse/CALCITE-3626 > Project: Calcite > Issue Type: Wish > Reporter: xzh_dz > Priority: Major > > when i run those codes as below, i get some error messages.it seems like > materialized view can not be matched correctly. > code: > {code:java} > @Test public void testSort0() { > String mv = "select \"deptno\", \"commission\" from \"emps\" order by > \"deptno\""; > String query = "select \"deptno\" , \"commission\" from \"emps\" order by > \"commission\""; > checkMaterialize(mv, query, true); > } > {code} > {code:java} > @Test public void testSort1() { > String mv = "select \"deptno\", \"commission\" from \"emps\" order by > \"deptno\""; > String query = "select \"commission\", \"deptno\" from \"emps\" order by > \"commission\""; > checkMaterialize(mv, query, true); > } > {code} > exception: > java.lang.AssertionError: > Expected: a string containing "EnumerableTableScan(table=[[hr, m0]])" > but: was "PLAN=EnumerableSort(sort0=[$0], dir0=[ASC])\n > EnumerableCalc(expr#0..4=[{inputs}], commission=[$t4], deptno=[$t1])\n > EnumerableTableScan(table=[[hr, emps]])\n\n" > <Click to see difference> > at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18) > at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6) > at > org.apache.calcite.test.CalciteAssert.lambda$checkResultContains$7(CalciteAssert.java:429) > at > org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:544) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1514) > at > org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1446) -- This message was sent by Atlassian Jira (v8.3.4#803005)