Hi,

When running the following query in CsvTest.java with model-with-view.json,

@Test public void testView() throws SQLException {
    checkSql("model-with-view","select EMPS.NAME, FEMALE_EMPS.NAME"
            + " from EMPS, FEMALE_EMPS"
            + " where EMPS.EMPID = FEMALE_EMPS.EMPID");
  }

I got the exception below when logger.level=FINER.

I found that HepPlanner.dumpGraph() (executed when logger.level>=FINER) led to 
HepPlanner.getCost(rel) being called and then later on 
HepRelVertex.computeSelfCost(rel) being called and subsequently the exception.

Tracing with the eclipse debugger, I also observed that 
"HepRelVertex.computeSelfCost(rel)" is executed when in the rel(in 
HepPlanner.getCost(rel)) tree, one of the relnode's 
metadataProvider=DefaultRelMetadataProvider.

Any suggestions on how should this be resolved?

java.sql.SQLException: error while executing SQL "select EMPS.NAME, 
FEMALE_EMPS.NAME from EMPS, FEMALE_EMPS where EMPS.EMPID = FEMALE_EMPS.EMPID": 
null
                at 
org.apache.calcite.avatica.Helper.createException(Helper.java:41)
                at 
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:112)
                at 
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:130)
                at org.apache.calcite.test.CsvTest.checkSql(CsvTest.java:237)
                at org.apache.calcite.test.CsvTest.checkSql(CsvTest.java:189)
                at org.apache.calcite.test.CsvTest.testView(CsvTest.java:369)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94)
                at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
                at java.lang.reflect.Method.invoke(Method.java:619)
                at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
                at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
                at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
                at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
                at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
                at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
                at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
                at 
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
                at 
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
                at 
org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
                at 
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
                at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
                at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
                at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.reflect.UndeclaredThrowableException
                at com.sun.proxy.$Proxy16.getCumulativeCost(Unknown Source)
                at 
org.apache.calcite.rel.metadata.RelMetadataQuery.getCumulativeCost(RelMetadataQuery.java:101)
                at 
org.apache.calcite.plan.AbstractRelOptPlanner.getCost(AbstractRelOptPlanner.java:251)
                at 
org.apache.calcite.plan.hep.HepPlanner.dumpGraph(HepPlanner.java:962)
                at 
org.apache.calcite.plan.hep.HepPlanner.setRoot(HepPlanner.java:151)
                at org.apache.calcite.tools.Programs$2.run(Programs.java:197)
                at 
org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:320)
                at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:142)
                at 
org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:280)
                at 
org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:188)
                at 
org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:669)
                at 
org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:570)
                at 
org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:539)
                at 
org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:175)
                at 
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:504)
                at 
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:477)
                at 
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:109)
                ... 27 more
Caused by: java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94)
                at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
                at java.lang.reflect.Method.invoke(Method.java:619)
                at 
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider$ChainedInvocationHandler.invoke(ChainedRelMetadataProvider.java:109)
                ... 44 more
:
:
Caused by: java.lang.AssertionError: Internal error: should never get here
                                at 
org.apache.calcite.util.Util.newInternal(Util.java:775)
                                at 
org.apache.calcite.plan.hep.HepRelVertex.computeSelfCost(HepRelVertex.java:68)
                                at 
org.apache.calcite.rel.metadata.RelMdPercentageOriginalRows.getNonCumulativeCost(RelMdPercentageOriginalRows.java:165)
                                ... 87 more


Thanks & Regards,

Yuri Au Yong
Software Engineer - NPM | [email protected] | Desk: +60 3 7663 8372
Persistent Systems Ltd. | Partners in Innovation | 
www.persistentsys.com<http://www.persistentsys.com/>
[sign1]<https://tnpmsupport.persistentsys.com/training>


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.

Reply via email to