The assertion mandates that the input of the ElasticSearchProject be of the ElasticSearch convnetion. I believe you need to create a converter that changes the Join node convention to ElasticSearch convention but this means that ElasticSearch can run joins, which I don't know about. Or, you need to fix\disable the rule that converted that project's convention to ElasticSearch.
Please correct me if I'm wrong, I'm still in the process of comprehending conventions. Reference: https://github.com/apache/calcite/blob/branch-1.15/core/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchProject.java#L44 Thanks, Gelbana On Mon, May 14, 2018 at 3:15 PM, Michael Mior <[email protected]> wrote: > Attachments can't be sent to this list. Either include attachments in the > body of the email or post a link to something like a GitHub gist. > > -- > Michael Mior > [email protected] > > > Le lun. 14 mai 2018 à 08:22, liuxiaorui <[email protected]> a écrit : > > > my calcite version is 1.15.0 , elasticsearch verison is 5.3.0 and > > model file is model1.json in attachment. > > > > the mapping of table1 : > > {"db":{"mappings":{"table1":{"properties":{"birthday":{" > type":"date"},"id":{"type":"integer"},"int1":{"type":" > integer"},"str1":{"type":"text"}}}}}} > > the mapping of table2 : > > {"db":{"mappings":{"table2":{"properties":{"id":{"type":" > integer"},"int1":{"type":"integer"},"str1":{"type":"text"}}}}}} > > > > 1.select table1.\"id\",table1.\"str1\",table2.\"int1\" from table1 > inner join table2 on table1.\"id\" = table2.\"id\" where table2.\"id\" = 1 > > > > 2.select * from table1 inner join table2 on table1.\"id\" = > table2.\"id\" where table1.\"id\" = 1 > > > > 3.select table1.\"id\",table1.\"str1\",table2.\"int1\" from table1 > inner join table2 on table1.\"id\" = table2.\"id\" where table1.\"id\" = 1 > > > > sql grammer 1 and 2 can be executed successfully ,but 3 failed . and the > error log is as follows > > > > java.lang.AssertionError > > at org.apache.calcite.adapter.elasticsearch. > ElasticsearchProject.<init>(ElasticsearchProject.java:44) > > at org.apache.calcite.adapter.elasticsearch. > ElasticsearchProject.copy(ElasticsearchProject.java:49) > > at org.apache.calcite.rel.rules.FilterProjectTransposeRule. > onMatch(FilterProjectTransposeRule.java:131) > > at org.apache.calcite.plan.volcano.VolcanoRuleCall. > onMatch(VolcanoRuleCall.java:212) > > at org.apache.calcite.plan.volcano.VolcanoPlanner. > findBestExp(VolcanoPlanner.java:650) > > at org.apache.calcite.tools.Programs$5.run(Programs.java:326) > > at org.apache.calcite.tools.Programs$SequenceProgram.run( > Programs.java:387) > > at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:188) > > at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:319) > > at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230) > > at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_( > CalcitePrepareImpl.java:781) > > at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_( > CalcitePrepareImpl.java:640) > > at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql( > CalcitePrepareImpl.java:610) > > at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery( > CalciteConnectionImpl.java:221) > > at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute( > CalciteMetaImpl.java:603) > > at org.apache.calcite.avatica.AvaticaConnection. > prepareAndExecuteInternal(AvaticaConnection.java:638) > > at org.apache.calcite.avatica.AvaticaStatement.executeInternal( > AvaticaStatement.java:149) > > at org.apache.calcite.avatica.AvaticaStatement.execute( > AvaticaStatement.java:209) > > at org.apache.calcite.test.ElasticsearchAdapterTest. > testElasticSearch(ElasticsearchAdapterTest.java:35) > > 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 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) > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
