It seems that you got some problem with the generated code, take this [1] to 
debug the code and to see which line caused the compilation error.

[1] 
https://calcite.apache.org/docs/howto.html#debugging-generated-classes-in-intellij

Best,
Danny Chan
在 2020年7月22日 +0800 AM12:17,taojin <[email protected]>,写道:
> hi folks,
>
> I has met a compiler error on calcite-core:1.23.0,jdk version is
> :openjdk version "11.0.7" 2020-04-14.
>
> Here is the error log,is this a bug?
>
> Exception in thread "main" java.sql.SQLException: Error while executing
> SQL "select * from test.t": Error while compiling generated Java code:
> public org.apache.calcite.linq4j.Enumerable bind(final
> org.apache.calcite.DataContext root) {
>   final org.apache.calcite.linq4j.function.Function1 rowBuilderFactory
> = new org.apache.calcite.linq4j.function.Function1() {
>     public org.apache.calcite.linq4j.function.Function0 apply(final
> java.sql.ResultSet resultSet) {
>       return new org.apache.calcite.linq4j.function.Function0() {
>           public Object apply() {
>             try {
>               return new Object[0];
>             } catch (java.sql.SQLException e) {
>               throw new RuntimeException(
>                 e);
>             }
>           }
>         }
>       ;
>     }
>     public Object apply(final Object resultSet) {
>       return apply(
>         (java.sql.ResultSet) resultSet);
>     }
>   }
>   ;
>   final org.apache.calcite.runtime.ResultSetEnumerable enumerable =
> org.apache.calcite.runtime.ResultSetEnumerable.of((javax.sql.DataSource)
> root.getRootSchema().getSubSchema("test").unwrap(javax.sql.DataSource.class),
> "SELECT *\nFROM hdb.t", rowBuilderFactory);
>   enumerable.setTimeout(root);
>   return enumerable;
> }
>
>
> public Class getElementType() {
>   return org.apache.calcite.runtime.FlatLists.ComparableList.class;
> }
>
>
>
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
>     at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
>     at
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
>     at
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
>     at mtest.App5.main(App5.java:45)
> Caused by: java.lang.RuntimeException: Error while compiling generated
> Java code:
> public org.apache.calcite.linq4j.Enumerable bind(final
> org.apache.calcite.DataContext root) {
>   final org.apache.calcite.linq4j.function.Function1 rowBuilderFactory
> = new org.apache.calcite.linq4j.function.Function1() {
>     public org.apache.calcite.linq4j.function.Function0 apply(final
> java.sql.ResultSet resultSet) {
>       return new org.apache.calcite.linq4j.function.Function0() {
>           public Object apply() {
>             try {
>               return new Object[0];
>             } catch (java.sql.SQLException e) {
>               throw new RuntimeException(
>                 e);
>             }
>           }
>         }
>       ;
>     }
>     public Object apply(final Object resultSet) {
>       return apply(
>         (java.sql.ResultSet) resultSet);
>     }
>   }
>   ;
>   final org.apache.calcite.runtime.ResultSetEnumerable enumerable =
> org.apache.calcite.runtime.ResultSetEnumerable.of((javax.sql.DataSource)
> root.getRootSchema().getSubSchema("test").unwrap(javax.sql.DataSource.class),
> "SELECT *\nFROM hdb.t", rowBuilderFactory);
>   enumerable.setTimeout(root);
>   return enumerable;
> }
>
>
> public Class getElementType() {
>   return org.apache.calcite.runtime.FlatLists.ComparableList.class;
> }
>
>
>
>     at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
>     at
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:128)
>     at
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1111)
>     at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:309)
>     at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:208)
>     at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:632)
>     at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:498)
>     at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:468)
>     at
> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
>     at
> org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:552)
>     at
> org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
>     at
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
>     ... 2 more
> Caused by: org.codehaus.commons.compiler.CompileException: Line 8,
> Column 20: Catch clause is unreachable
>     at
> org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211)
>     at
> org.codehaus.janino.UnitCompiler.compileTryCatch(UnitCompiler.java:3110)
>     at
> org.codehaus.janino.UnitCompiler.compileTryCatchFinally(UnitCompiler.java:2966)
>     at
> org.codehaus.janino.UnitCompiler.compileTryCatchFinallyWithResources(UnitCompiler.java:2770)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2742)
>     at org.codehaus.janino.UnitCompiler.access$2300(UnitCompiler.java:215)
>     at
> org.codehaus.janino.UnitCompiler$6.visitTryStatement(UnitCompiler.java:1499)
>     at
> org.codehaus.janino.UnitCompiler$6.visitTryStatement(UnitCompiler.java:1487)
>     at org.codehaus.janino.Java$TryStatement.accept(Java.java:3241)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487)
>     at
> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1567)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3388)
>     at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1357)
>     at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1330)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:822)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:981)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:951)
>     at org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:215)
>     at
> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:409)
>     at
> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:406)
>     at
> org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1149)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:406)
>     at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5509)
>     at org.codehaus.janino.UnitCompiler.access$9500(UnitCompiler.java:215)
>     at
> org.codehaus.janino.UnitCompiler$16.visitNewAnonymousClassInstance(UnitCompiler.java:4432)
>     at
> org.codehaus.janino.UnitCompiler$16.visitNewAnonymousClassInstance(UnitCompiler.java:4396)
>     at
> org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5238)
>     at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4396)
>     at
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5662)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2649)
>     at org.codehaus.janino.UnitCompiler.access$2800(UnitCompiler.java:215)
>     at
> org.codehaus.janino.UnitCompiler$6.visitReturnStatement(UnitCompiler.java:1504)
>     at
> org.codehaus.janino.UnitCompiler$6.visitReturnStatement(UnitCompiler.java:1487)
>     at org.codehaus.janino.Java$ReturnStatement.accept(Java.java:3563)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487)
>     at
> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1567)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3388)
>     at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1357)
>     at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1330)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:822)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:981)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:951)
>     at org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:215)
>     at
> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:409)
>     at
> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:406)
>     at
> org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1149)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:406)
>     at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5509)
>     at org.codehaus.janino.UnitCompiler.access$9500(UnitCompiler.java:215)
>     at
> org.codehaus.janino.UnitCompiler$16.visitNewAnonymousClassInstance(UnitCompiler.java:4432)
>     at
> org.codehaus.janino.UnitCompiler$16.visitNewAnonymousClassInstance(UnitCompiler.java:4396)
>     at
> org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5238)
>     at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4396)
>     at
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5662)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2580)
>     at org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:215)
>     at
> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1503)
>     at
> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1487)
>     at
> org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3522)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487)
>     at
> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1567)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3388)
>     at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1357)
>     at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1330)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:822)
>     at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:432)
>     at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:215)
>     at
> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:411)
>     at
> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:406)
>     at
> org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1414)
>     at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:406)
>     at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:378)
>     at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:237)
>     at
> org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java:465)
>     at
> org.codehaus.janino.ClassBodyEvaluator.compileToClass(ClassBodyEvaluator.java:313)
>     at
> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:235)
>     at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:207)
>     at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:50)
>     at
> org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:347)
>     at
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:162)
>     at
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:125)
>     ... 12 more
>
>

Reply via email to