Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.9.1-incubating
-
None
-
None
Description
If use the following code in checkTableMacroInModel
select count(*) from table("adhoc"."View"(' (30)')) "a", lateral(select * from table("adhoc"."View"('('||cast("a"."c" as char)||')'))) b
private static QueryableTable oneThreePlus(String s) { List<Object> items; if (s != null) { // Argument can be null in "describe" phase when data type is required Integer latest = Integer.parseInt(s.substring(1, s.length() - 1)); items = Arrays.<Object>asList(1, 3, latest); } else items = Collections.emptyList();
PLAN=EnumerableAggregateRel(group=[{}], EXPR$0=[COUNT()]) EnumerableCalcRel(expr#0..1=[{inputs}], expr#2=[0], DUMMY=[$t2]) EnumerableJoinRel(condition=[true], joinType=[inner]) EnumerableTableFunctionRel(invocation=[View('(30)')], rowType=[RecordType(INTEGER c)], elementType=[class [Ljava.lang.Object;]) EnumerableTableFunctionRel(invocation=[View(||(||('(', CAST($cor0.c):CHAR(1) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" NOT NULL), ')'))], rowType=[RecordType(INTEGER c)], elementType=[class [Ljava.lang.Object;
The following exception appears:
java.lang.RuntimeException: exception while executing [select count(*) from table("adhoc"."View"('(30)')) "a", lateral(select * from table("adhoc"."View"('('||cast("a"."c" as char)||')'))) b] at net.hydromatic.optiq.test.OptiqAssert$AssertQuery.returns(OptiqAssert.java:1051) at net.hydromatic.optiq.test.OptiqAssert$AssertQuery.returns(OptiqAssert.java:1041) at net.hydromatic.optiq.test.OptiqAssert$AssertQuery.returns(OptiqAssert.java:1029) at net.hydromatic.optiq.test.JdbcTest.checkTableMacroInModel(JdbcTest.java:466) at net.hydromatic.optiq.test.JdbcTest.testTableFunctionInModel(JdbcTest.java:435) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 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.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.lang.RuntimeException: With materializationsEnabled=false, limit=0 at net.hydromatic.optiq.test.OptiqAssert.assertQuery(OptiqAssert.java:419) at net.hydromatic.optiq.test.OptiqAssert$AssertQuery.returns(OptiqAssert.java:1047) ... 30 more Caused by: java.sql.SQLException: error while executing SQL "select count(*) from table("adhoc"."View"('(30)')) "a", lateral(select * from table("adhoc"."View"('('||cast("a"."c" as char)||')'))) b": cannot translate expression $cor0.c at net.hydromatic.avatica.Helper.createException(Helper.java:39) at net.hydromatic.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:79) at net.hydromatic.optiq.test.OptiqAssert.assertQuery(OptiqAssert.java:394) ... 31 more Caused by: java.lang.RuntimeException: cannot translate expression $cor0.c at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate0(RexToLixTranslator.java:407) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:166) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:161) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateList(RexToLixTranslator.java:589) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateList(RexToLixTranslator.java:562) at net.hydromatic.optiq.rules.java.RexImpTable.implementCall(RexImpTable.java:677) at net.hydromatic.optiq.rules.java.RexImpTable.implementNullSemantics(RexImpTable.java:667) at net.hydromatic.optiq.rules.java.RexImpTable.implementNullSemantics0(RexImpTable.java:592) at net.hydromatic.optiq.rules.java.RexImpTable.access$900(RexImpTable.java:57) at net.hydromatic.optiq.rules.java.RexImpTable$2.implement(RexImpTable.java:267) at net.hydromatic.optiq.rules.java.RexImpTable$CastOptimizedImplementor.implement(RexImpTable.java:1426) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateCall(RexToLixTranslator.java:433) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate0(RexToLixTranslator.java:405) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:166) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:161) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateList(RexToLixTranslator.java:589) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateList(RexToLixTranslator.java:562) at net.hydromatic.optiq.rules.java.RexImpTable.implementCall(RexImpTable.java:677) at net.hydromatic.optiq.rules.java.RexImpTable.implementNullSemantics(RexImpTable.java:667) at net.hydromatic.optiq.rules.java.RexImpTable.implementNullSemantics0(RexImpTable.java:592) at net.hydromatic.optiq.rules.java.RexImpTable.access$900(RexImpTable.java:57) at net.hydromatic.optiq.rules.java.RexImpTable$2.implement(RexImpTable.java:267) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateCall(RexToLixTranslator.java:433) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate0(RexToLixTranslator.java:405) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:166) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:161) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateList(RexToLixTranslator.java:589) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateList(RexToLixTranslator.java:562) at net.hydromatic.optiq.rules.java.RexImpTable.implementCall(RexImpTable.java:677) at net.hydromatic.optiq.rules.java.RexImpTable.implementNullSemantics(RexImpTable.java:667) at net.hydromatic.optiq.rules.java.RexImpTable.implementNullSemantics0(RexImpTable.java:592) at net.hydromatic.optiq.rules.java.RexImpTable.access$900(RexImpTable.java:57) at net.hydromatic.optiq.rules.java.RexImpTable$2.implement(RexImpTable.java:267) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateCall(RexToLixTranslator.java:433) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate0(RexToLixTranslator.java:405) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:166) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:161) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateList(RexToLixTranslator.java:589) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateList(RexToLixTranslator.java:562) at net.hydromatic.optiq.rules.java.RexImpTable.implementCall(RexImpTable.java:677) at net.hydromatic.optiq.rules.java.RexImpTable.implementNullSemantics(RexImpTable.java:667) at net.hydromatic.optiq.rules.java.RexImpTable.implementNullSemantics0(RexImpTable.java:592) at net.hydromatic.optiq.rules.java.RexImpTable.access$900(RexImpTable.java:57) at net.hydromatic.optiq.rules.java.RexImpTable$2.implement(RexImpTable.java:267) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translateCall(RexToLixTranslator.java:433) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate0(RexToLixTranslator.java:405) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:166) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:155) at net.hydromatic.optiq.rules.java.RexToLixTranslator.translate(RexToLixTranslator.java:151) at net.hydromatic.optiq.rules.java.JavaRules$EnumerableTableFunctionRel.implement(JavaRules.java:3373) at net.hydromatic.optiq.rules.java.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:61) at net.hydromatic.optiq.rules.java.JavaRules$EnumerableJoinRel.implement(JavaRules.java:248) at net.hydromatic.optiq.rules.java.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:61) at net.hydromatic.optiq.rules.java.JavaRules$EnumerableCalcRel.implement(JavaRules.java:855) at net.hydromatic.optiq.rules.java.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:61) at net.hydromatic.optiq.rules.java.JavaRules$EnumerableAggregateRel.implement(JavaRules.java:1085) at net.hydromatic.optiq.rules.java.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:66) at net.hydromatic.optiq.prepare.OptiqPrepareImpl$OptiqPreparingStmt.implement(OptiqPrepareImpl.java:806) at net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:282) at net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:178) at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare2_(OptiqPrepareImpl.java:420) at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare_(OptiqPrepareImpl.java:325) at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepareSql(OptiqPrepareImpl.java:294) at net.hydromatic.optiq.jdbc.OptiqConnectionImpl.parseQuery(OptiqConnectionImpl.java:170) at net.hydromatic.optiq.jdbc.MetaImpl.prepare(MetaImpl.java:622) at net.hydromatic.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:76) ... 32 more