I tried to reproduce the first problem related with ProjectTableScanRule with the current master but I didn't succeed. I assumed that the table in question implements the FilterableTable or ProjectableFilterableTable interface but I guess I am missing some other important parameters.
On Fri, Aug 2, 2019 at 9:17 PM Julian Hyde <jh...@apache.org> wrote: > Do you think you are running into > https://issues.apache.org/jira/browse/CALCITE-3145 < > https://issues.apache.org/jira/browse/CALCITE-3145>? > > > On Aug 2, 2019, at 2:00 AM, Chunwei Lei <chunwei.l...@gmail.com> wrote: > > > > Hi, Amit. Thank you for reporting this. > > > > I suggest you opening a jira to track this. Besides, it would be great if > > you can provide more > > details to reproduce these issues. > > > > > > > > > > Best, > > Chunwei > > > > > > On Fri, Aug 2, 2019 at 10:22 AM Amit Chavan <achav...@gmail.com> wrote: > > > >> Hello, > >> > >> I wanted to see if I can get some help on issues I have noticed with > >> calcite 1.20 release. These issues do not happen in the previous > releases > >> of calcite. I have confirmed that. > >> > >> Query - "SELECT MIN(n1) as mi, MAX(n1) as ma FROM tblspace1.tsql WHERE > >> k1='no_results' GROUP BY k1" > >> > >> java.lang.RuntimeException: Error while applying rule > >> ProjectScanRule:interpreter, args > >> > [rel#264:EnumerableProject.ENUMERABLE.[](input=RelSubset#263,MI=$1,MA=$1), > >> rel#317:EnumerableInterpreter.ENUMERABLE.[](input=RelSubset#291), > >> rel#290:BindableTableScan.BINDABLE.[](table=[tblspace1, > >> tsql],filters=[=($0, 'no_results')])] > >> > >> at > >> > >> > org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:235) > >> at > >> > >> > org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:631) > >> at herddb.sql.CalcitePlanner.runPlanner(CalcitePlanner.java:527) > >> at herddb.sql.CalcitePlanner.translate(CalcitePlanner.java:293) > >> at herddb.core.TestUtils.scan(TestUtils.java:70) > >> at herddb.core.RawSQLTest.simpleMinMaxTest(RawSQLTest.java:1389) > >> 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:497) > >> at > >> > >> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > >> at > >> > >> > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > >> at > >> > >> > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > >> at > >> > >> > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > >> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > >> at > >> > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) > >> at > >> > >> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) > >> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > >> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > >> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > >> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > >> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > >> at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > >> at org.junit.runner.JUnitCore.run(JUnitCore.java:137) > >> at > >> > >> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) > >> at > >> > >> > com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) > >> at > >> > >> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) > >> at > >> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) > >> Caused by: java.lang.IllegalArgumentException: source #1 is already > mapped > >> to target #1 > >> at > >> > >> > org.apache.calcite.util.mapping.Mappings$SurjectionWithInverse.set(Mappings.java:1326) > >> at org.apache.calcite.rel.core.Project.getMapping(Project.java:279) > >> at org.apache.calcite.rel.core.Project.getMapping(Project.java:250) > >> at > >> > >> > org.apache.calcite.rel.rules.ProjectTableScanRule.apply(ProjectTableScanRule.java:107) > >> at > >> > >> > org.apache.calcite.rel.rules.ProjectTableScanRule$2.onMatch(ProjectTableScanRule.java:83) > >> at > >> > >> > org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) > >> ... 27 more > >> > >> Query 2- > >> "UPDATE tblspace1.table1 set n1=1000" > >> + "WHERE k1 in (SELECT fk FROM tblspace1.table2 WHERE > >> k2=?)" > >> > >> java.lang.UnsupportedOperationException: class > >> org.apache.calcite.sql.SqlBasicCall: `K1` IN (SELECT `table2`.`fk` AS > `FK` > >> FROM `tblspace1`.`table2` AS `TABLE2` > >> WHERE `table2`.`k2` = ?) > >> > >> at org.apache.calcite.util.Util.needToImplement(Util.java:967) > >> at > >> > >> > org.apache.calcite.sql.validate.SqlValidatorImpl.getValidatedNodeType(SqlValidatorImpl.java:1579) > >> at > >> > >> > org.apache.calcite.sql2rel.SqlToRelConverter.findSubQueries(SqlToRelConverter.java:1802) > >> at > >> > >> > org.apache.calcite.sql2rel.SqlToRelConverter.findSubQueries(SqlToRelConverter.java:1776) > >> at > >> > >> > org.apache.calcite.sql2rel.SqlToRelConverter.replaceSubQueries(SqlToRelConverter.java:1011) > >> at > >> > >> > org.apache.calcite.sql2rel.SqlToRelConverter.convertUpdate(SqlToRelConverter.java:3570) > >> at > >> > >> > org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3172) > >> at > >> > >> > org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:563) > >> at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:254) > >> > >