You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by xiaobo <gu...@qq.com.INVALID> on 2022/02/11 10:16:59 UTC

calcite multi-threading problem

Hi,


we open a calcite connection with ReflectiveSchema in one thread, and execute sqls in other  threads against the connection, but failed with  this error




com.google.common.util.concurrent.ExecutionError: 
java.lang.NoSuchMethodError: 
org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)

Lorg/codehaus/commons/compiler/ICompilerFactory;


do we miss anything regarding to multi-threading with calcite?

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
sorry about that, I'll correct it.

------------------ Original ------------------
From:  "Julian Hyde";<jh...@gmail.com>;
Send time: Saturday, Feb 12, 2022 9:41 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



xiaobo,

Your emails are coming through with a lot of HTML escape characters [1]. To make them more readable for everyone else, could you perhaps try sending in “Plain text” mode?

Julian

[1] https://lists.apache.org/thread/ttrlw4c441br27lppxl77osbgxrv58wn

> On Feb 11, 2022, at 5:36 PM, xiaobo <gu...@qq.com.INVALID> wrote:
> 
> can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6&nbsp; is only dependent by calcite-core.
> 
> 
> &nbsp;&nbsp;&nbsp; <properties&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <project.build.sourceEncoding&gt;UTF-8</project.build.sourceEncoding&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.encoding&gt;UTF-8</maven.compiler.encoding&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <java.version&gt;9</java.version&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.source&gt;9</maven.compiler.source&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.target&gt;9</maven.compiler.target&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <log4j2.version&gt;2.17.1</log4j2.version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <drools.version&gt;7.64.0.Final</drools.version&gt;
> &nbsp;&nbsp; </properties&gt;
> 
> 
> 
> <groupId&gt;org.apache.calcite</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;calcite-core</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;1.29.0</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.apache.calcite.avatica</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;avatica-core</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;1.20.0</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> 
> 
> 
> 
> &nbsp;&nbsp;&nbsp; <dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-core</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-compiler</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-decisiontables</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> 
> 
> 
> 
> 
> 
> 
> 
> ------------------&nbsp;Original&nbsp;------------------
> From: &nbsp;"xiong duan";<nobigogle@gmail.com&gt;;
> Send time:&nbsp;Saturday, Feb 12, 2022 8:43 AM
> To:&nbsp;"dev"<dev@calcite.apache.org&gt;; 
> 
> Subject: &nbsp;Re: calcite multi-threading problem
> 
> 
> 
> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
> 
> Dmitry Sysolyatin <dm.sysolyatin@gmail.com&gt; 于2022年2月11日周五 21:18写道:
> 
> &gt; Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> &gt; version of janino, calcite 1.29 uses the new version of janino and they are
> &gt; not compatible.
> &gt; If I downgrade janino version to version which spark uses I got an error
> &gt; not method found exception
> &gt; If I upgrade the janino version to the version which calcite uses I get the
> &gt; same error but with another method.
> &gt;
> &gt; As a result, I built a separate calcite jar package where I shaded janino
> &gt; dependency
> &gt;
> &gt;
> &gt;
> &gt; On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> &gt; estanilovskiy@gridgain.com&gt; wrote:
> &gt;
> &gt; &gt; for example on a current calcite branch:
> &gt; &gt; grep janino gradle.properties
> &gt; &gt; janino.version=3.1.6
> &gt; &gt;
> &gt; &gt;
> &gt; &gt; &gt; yes, we use drools in the same project,&amp;nbsp; and drools uses janino
> &gt; &gt; &gt; too, is there a version list of janino which calcite supports?
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt; &gt; ---Original---
> &gt; &gt; &gt; From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&amp;gt;
> &gt; &gt; &gt; Date: Fri, Feb 11, 2022 18:30 PM
> &gt; &gt; &gt; To: "dev"<dev@calcite.apache.org&amp;gt;;
> &gt; &gt; &gt; Subject: Re: calcite multi-threading problem
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt; &gt; Hi!
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; It&amp;nbsp;looks&amp;nbsp;like&amp;nbsp;a&amp;nbsp;dependency&amp;nbsp;issue,&amp;nbsp;not&amp;nbsp;like&amp;nbsp;a&amp;nbsp;multi-threading&amp;nbsp;issue.&amp;nbsp;Most
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; likely&amp;nbsp;you&amp;nbsp;have&amp;nbsp;some&amp;nbsp;dependency&amp;nbsp;that&amp;nbsp;use&amp;nbsp;another&amp;nbsp;version&amp;nbsp;of&amp;nbsp;janino&amp;nbsp;but
> &gt; &gt; &gt; calcite&amp;nbsp;requires&amp;nbsp;another&amp;nbsp;one
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; On&amp;nbsp;Fri,&amp;nbsp;Feb&amp;nbsp;11,&amp;nbsp;2022&amp;nbsp;at&amp;nbsp;12:18&amp;nbsp;PM&amp;nbsp;xiaobo&amp;nbsp;<guxiaobo1982@qq.com.invalid
> &gt; &gt; &amp;gt;&amp;nbsp;wrote:
> &gt; &gt; &gt;
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;Hi,
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; &amp;gt;&amp;nbsp;we&amp;nbsp;open&amp;nbsp;a&amp;nbsp;calcite&amp;nbsp;connection&amp;nbsp;with&amp;nbsp;ReflectiveSchema&amp;nbsp;in&amp;nbsp;one&amp;nbsp;thread,&amp;nbsp;and
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; &amp;gt;&amp;nbsp;execute&amp;nbsp;sqls&amp;nbsp;in&amp;nbsp;other&amp;nbsp;&amp;nbsp;threads&amp;nbsp;against&amp;nbsp;the&amp;nbsp;connection,&amp;nbsp;but&amp;nbsp;failed&amp;nbsp;with
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;this&amp;nbsp;error
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;com.google.common.util.concurrent.ExecutionError:
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;java.lang.NoSuchMethodError:
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; &amp;gt;&amp;nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; &amp;gt;&amp;nbsp;do&amp;nbsp;we&amp;nbsp;miss&amp;nbsp;anything&amp;nbsp;regarding&amp;nbsp;to&amp;nbsp;multi-threading&amp;nbsp;with&amp;nbsp;calcite?
> &gt; &gt;
> &gt;

Re: calcite multi-threading problem

Posted by Julian Hyde <jh...@gmail.com>.
xiaobo,

Your emails are coming through with a lot of HTML escape characters [1]. To make them more readable for everyone else, could you perhaps try sending in “Plain text” mode?

Julian

[1] https://lists.apache.org/thread/ttrlw4c441br27lppxl77osbgxrv58wn

> On Feb 11, 2022, at 5:36 PM, xiaobo <gu...@qq.com.INVALID> wrote:
> 
> can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6&nbsp; is only dependent by calcite-core.
> 
> 
> &nbsp;&nbsp;&nbsp; <properties&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <project.build.sourceEncoding&gt;UTF-8</project.build.sourceEncoding&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.encoding&gt;UTF-8</maven.compiler.encoding&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <java.version&gt;9</java.version&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.source&gt;9</maven.compiler.source&gt;
> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.target&gt;9</maven.compiler.target&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <log4j2.version&gt;2.17.1</log4j2.version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <drools.version&gt;7.64.0.Final</drools.version&gt;
> &nbsp;&nbsp; </properties&gt;
> 
> 
> 
> <groupId&gt;org.apache.calcite</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;calcite-core</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;1.29.0</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.apache.calcite.avatica</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;avatica-core</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;1.20.0</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> 
> 
> 
> 
> &nbsp;&nbsp;&nbsp; <dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-core</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-compiler</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-decisiontables</artifactId&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
> 
> 
> 
> 
> 
> 
> 
> 
> ------------------&nbsp;Original&nbsp;------------------
> From: &nbsp;"xiong duan";<nobigogle@gmail.com&gt;;
> Send time:&nbsp;Saturday, Feb 12, 2022 8:43 AM
> To:&nbsp;"dev"<dev@calcite.apache.org&gt;; 
> 
> Subject: &nbsp;Re: calcite multi-threading problem
> 
> 
> 
> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
> 
> Dmitry Sysolyatin <dm.sysolyatin@gmail.com&gt; 于2022年2月11日周五 21:18写道:
> 
> &gt; Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> &gt; version of janino, calcite 1.29 uses the new version of janino and they are
> &gt; not compatible.
> &gt; If I downgrade janino version to version which spark uses I got an error
> &gt; not method found exception
> &gt; If I upgrade the janino version to the version which calcite uses I get the
> &gt; same error but with another method.
> &gt;
> &gt; As a result, I built a separate calcite jar package where I shaded janino
> &gt; dependency
> &gt;
> &gt;
> &gt;
> &gt; On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> &gt; estanilovskiy@gridgain.com&gt; wrote:
> &gt;
> &gt; &gt; for example on a current calcite branch:
> &gt; &gt; grep janino gradle.properties
> &gt; &gt; janino.version=3.1.6
> &gt; &gt;
> &gt; &gt;
> &gt; &gt; &gt; yes, we use drools in the same project,&amp;nbsp; and drools uses janino
> &gt; &gt; &gt; too, is there a version list of janino which calcite supports?
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt; &gt; ---Original---
> &gt; &gt; &gt; From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&amp;gt;
> &gt; &gt; &gt; Date: Fri, Feb 11, 2022 18:30 PM
> &gt; &gt; &gt; To: "dev"<dev@calcite.apache.org&amp;gt;;
> &gt; &gt; &gt; Subject: Re: calcite multi-threading problem
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt; &gt; Hi!
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; It&amp;nbsp;looks&amp;nbsp;like&amp;nbsp;a&amp;nbsp;dependency&amp;nbsp;issue,&amp;nbsp;not&amp;nbsp;like&amp;nbsp;a&amp;nbsp;multi-threading&amp;nbsp;issue.&amp;nbsp;Most
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; likely&amp;nbsp;you&amp;nbsp;have&amp;nbsp;some&amp;nbsp;dependency&amp;nbsp;that&amp;nbsp;use&amp;nbsp;another&amp;nbsp;version&amp;nbsp;of&amp;nbsp;janino&amp;nbsp;but
> &gt; &gt; &gt; calcite&amp;nbsp;requires&amp;nbsp;another&amp;nbsp;one
> &gt; &gt; &gt;
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; On&amp;nbsp;Fri,&amp;nbsp;Feb&amp;nbsp;11,&amp;nbsp;2022&amp;nbsp;at&amp;nbsp;12:18&amp;nbsp;PM&amp;nbsp;xiaobo&amp;nbsp;<guxiaobo1982@qq.com.invalid
> &gt; &gt; &amp;gt;&amp;nbsp;wrote:
> &gt; &gt; &gt;
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;Hi,
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; &amp;gt;&amp;nbsp;we&amp;nbsp;open&amp;nbsp;a&amp;nbsp;calcite&amp;nbsp;connection&amp;nbsp;with&amp;nbsp;ReflectiveSchema&amp;nbsp;in&amp;nbsp;one&amp;nbsp;thread,&amp;nbsp;and
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; &amp;gt;&amp;nbsp;execute&amp;nbsp;sqls&amp;nbsp;in&amp;nbsp;other&amp;nbsp;&amp;nbsp;threads&amp;nbsp;against&amp;nbsp;the&amp;nbsp;connection,&amp;nbsp;but&amp;nbsp;failed&amp;nbsp;with
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;this&amp;nbsp;error
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;com.google.common.util.concurrent.ExecutionError:
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;java.lang.NoSuchMethodError:
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; &amp;gt;&amp;nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;&amp;nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt; &amp;gt;
> &gt; &gt; &gt;
> &gt; &gt;
> &gt; &amp;gt;&amp;nbsp;do&amp;nbsp;we&amp;nbsp;miss&amp;nbsp;anything&amp;nbsp;regarding&amp;nbsp;to&amp;nbsp;multi-threading&amp;nbsp;with&amp;nbsp;calcite?
> &gt; &gt;
> &gt;


Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6&nbsp; is only dependent by calcite-core.


&nbsp;&nbsp;&nbsp; <properties&gt;
&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <project.build.sourceEncoding&gt;UTF-8</project.build.sourceEncoding&gt;
&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.encoding&gt;UTF-8</maven.compiler.encoding&gt;
&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <java.version&gt;9</java.version&gt;
&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.source&gt;9</maven.compiler.source&gt;
&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <maven.compiler.target&gt;9</maven.compiler.target&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <log4j2.version&gt;2.17.1</log4j2.version&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <drools.version&gt;7.64.0.Final</drools.version&gt;
&nbsp;&nbsp; </properties&gt;



<groupId&gt;org.apache.calcite</groupId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;calcite-core</artifactId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;1.29.0</version&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.apache.calcite.avatica</groupId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;avatica-core</artifactId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;1.20.0</version&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;




&nbsp;&nbsp;&nbsp; <dependency&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-core</artifactId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-compiler</artifactId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <groupId&gt;org.drools</groupId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <artifactId&gt;drools-decisiontables</artifactId&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <version&gt;${drools.version}</version&gt;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;








------------------&nbsp;Original&nbsp;------------------
From: &nbsp;"xiong duan";<nobigogle@gmail.com&gt;;
Send time:&nbsp;Saturday, Feb 12, 2022 8:43 AM
To:&nbsp;"dev"<dev@calcite.apache.org&gt;; 

Subject: &nbsp;Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm.sysolyatin@gmail.com&gt; 于2022年2月11日周五 21:18写道:

&gt; Actually, I had the same problem with spark. Spark 3.2.1 uses the old
&gt; version of janino, calcite 1.29 uses the new version of janino and they are
&gt; not compatible.
&gt; If I downgrade janino version to version which spark uses I got an error
&gt; not method found exception
&gt; If I upgrade the janino version to the version which calcite uses I get the
&gt; same error but with another method.
&gt;
&gt; As a result, I built a separate calcite jar package where I shaded janino
&gt; dependency
&gt;
&gt;
&gt;
&gt; On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
&gt; estanilovskiy@gridgain.com&gt; wrote:
&gt;
&gt; &gt; for example on a current calcite branch:
&gt; &gt; grep janino gradle.properties
&gt; &gt; janino.version=3.1.6
&gt; &gt;
&gt; &gt;
&gt; &gt; &gt; yes, we use drools in the same project,&amp;nbsp; and drools uses janino
&gt; &gt; &gt; too, is there a version list of janino which calcite supports?
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; ---Original---
&gt; &gt; &gt; From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&amp;gt;
&gt; &gt; &gt; Date: Fri, Feb 11, 2022 18:30 PM
&gt; &gt; &gt; To: "dev"<dev@calcite.apache.org&amp;gt;;
&gt; &gt; &gt; Subject: Re: calcite multi-threading problem
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; Hi!
&gt; &gt; &gt;
&gt; &gt;
&gt; It&amp;nbsp;looks&amp;nbsp;like&amp;nbsp;a&amp;nbsp;dependency&amp;nbsp;issue,&amp;nbsp;not&amp;nbsp;like&amp;nbsp;a&amp;nbsp;multi-threading&amp;nbsp;issue.&amp;nbsp;Most
&gt; &gt; &gt;
&gt; &gt;
&gt; likely&amp;nbsp;you&amp;nbsp;have&amp;nbsp;some&amp;nbsp;dependency&amp;nbsp;that&amp;nbsp;use&amp;nbsp;another&amp;nbsp;version&amp;nbsp;of&amp;nbsp;janino&amp;nbsp;but
&gt; &gt; &gt; calcite&amp;nbsp;requires&amp;nbsp;another&amp;nbsp;one
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; On&amp;nbsp;Fri,&amp;nbsp;Feb&amp;nbsp;11,&amp;nbsp;2022&amp;nbsp;at&amp;nbsp;12:18&amp;nbsp;PM&amp;nbsp;xiaobo&amp;nbsp;<guxiaobo1982@qq.com.invalid
&gt; &gt; &amp;gt;&amp;nbsp;wrote:
&gt; &gt; &gt;
&gt; &gt; &gt; &amp;gt;&amp;nbsp;Hi,
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;we&amp;nbsp;open&amp;nbsp;a&amp;nbsp;calcite&amp;nbsp;connection&amp;nbsp;with&amp;nbsp;ReflectiveSchema&amp;nbsp;in&amp;nbsp;one&amp;nbsp;thread,&amp;nbsp;and
&gt; &gt; &gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;execute&amp;nbsp;sqls&amp;nbsp;in&amp;nbsp;other&amp;nbsp;&amp;nbsp;threads&amp;nbsp;against&amp;nbsp;the&amp;nbsp;connection,&amp;nbsp;but&amp;nbsp;failed&amp;nbsp;with
&gt; &gt; &gt; &amp;gt;&amp;nbsp;this&amp;nbsp;error
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt; &amp;gt;&amp;nbsp;com.google.common.util.concurrent.ExecutionError:
&gt; &gt; &gt; &amp;gt;&amp;nbsp;java.lang.NoSuchMethodError:
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt; &amp;gt;&amp;nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt; &amp;gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;do&amp;nbsp;we&amp;nbsp;miss&amp;nbsp;anything&amp;nbsp;regarding&amp;nbsp;to&amp;nbsp;multi-threading&amp;nbsp;with&amp;nbsp;calcite?
&gt; &gt;
&gt;

Re: calcite multi-threading problem

Posted by Stamatis Zampetakis <za...@gmail.com>.
Calcite is already using janino 3.1.6 since version 1.28.0 [1].

As pointed out in every release note compatibility with other libraries is
guaranteed only for those versions mentioned in the respective section and
gradle.properties.

In other words, the only version of Janino that is supposed to work with
Calcite 1.29.0 is the one in gradle properties, i.e., 3.1.6. Downgrading to
an older version is a bad idea.

As other people mentioned already, the problem is not in Calcite. You
should check with other projects to see if an upgrade of Janino on their
side is feasible otherwise you will probably need to create a shaded
Calcite jar on your side.

Lastly, if you think the problem is in Calcite then please create a JIRA
case as Julian suggested.

Best,
Stamatis

[1] https://issues.apache.org/jira/browse/CALCITE-3745

On Sat, Feb 26, 2022 at 9:27 PM Julian Hyde <jh...@gmail.com> wrote:

> To repeat, it would help if there were a Jira case. I don’t want to debug
> problems with janino 3.1.6 unless I know why we’re upgrading to 3.1.6.
> Also, we have a duty to reduce volume on the dev list.
>
> > On Feb 25, 2022, at 7:19 PM, xiaobo <gu...@qq.com.INVALID> wrote:
> >
> > Hi Gavin and Julian,
> > Thanks for your help, we know that upgrading janino and common compiler
> to 3.1.6 will fix the "operand stack underflow" error, but we have also
> have problem with 3.1.6 of janino as mentioned before:
> > ----------------------
> >
> > we checked the janino release note page
> > http://janino-compiler.github.io/janino/changelog.html
> >
> > Fixed issue #141: Unable to find
> org.codehaus.commons.compiler.properties in java 11: ICompilerFactories
> were loaded through the current thread's "context class loader", which is a
> bad choice in some environments. Thus, the methods
> "getDefaultCompilerFactory()", "getAllCompilerFactories()" and
> "getCompilerFactory(className)" were duplicated and augmented with a
> "classLoader" parameter.
> >
> > what does this mean?  the getDefaultCompilerFactory method with a
> classloader parameter was removed intentionally?
> > but it seems calcite still needs it .
> > --------------------
> >
> >
> > What we mean here is that we think calcite has a bug with janino 3.1.6 ,
> are we right?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ------------------ Original ------------------
> > From:  "Julian Hyde";<jh...@gmail.com>;
> > Send time: Saturday, Feb 26, 2022 1:24 AM
> > To: "dev"<de...@calcite.apache.org>;
> >
> > Subject:  Re: calcite multi-threading problem
> >
> >
> >
> > Should a jira case be logged for this issue? Or is there an existing
> case? If the latter, should we add a stack trace to help people tie it to
> this problem?
> >
> > A jira URL in this thread will help other people who run into this
> problem in future. Right now it is just a rambling email thread with an
> off-topic subject.
> >
> > Julian
> >
> >> On Feb 25, 2022, at 7:18 AM, Gavin Ray <ra...@gmail.com> wrote:
> >>
> >> Also I just checked and this is updated on master so it should be
> solved in
> >> next release FWIW:
> >>
> >>
> https://github.com/apache/calcite/blob/cbbe5701b7f61d7f8df12d314ba5aabf898c1cae/gradle.properties#L116
> >>
> >>> On Fri, Feb 25, 2022 at 10:16 AM Gavin Ray <ra...@gmail.com>
> wrote:
> >>>
> >>> The fix for this is just to add janino and commons-compiler as
> exclusions
> >>> in the calcite/avatica dependencies
> >>> And then add the updated version so that it overwrites them
> >>>
> >>> I tested this on your code and it worked
> >>>
> >>> Also, please listen to Stamatis/Julian advice
> >>>
> >>> <dependencies>
> >>> <dependency>
> >>> <groupId>org.apache.calcite</groupId>
> >>> <artifactId>calcite-core</artifactId>
> >>> <version>1.29.0</version>
> >>> <exclusions>
> >>> <exclusion>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>janino</artifactId>
> >>> </exclusion>
> >>> <exclusion>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>commons-compiler</artifactId>
> >>> </exclusion>
> >>> </exclusions>
> >>> </dependency>
> >>>
> >>> <dependency>
> >>> <groupId>org.apache.calcite.avatica</groupId>
> >>> <artifactId>avatica-core</artifactId>
> >>> <version>1.20.0</version>
> >>> <exclusions>
> >>> <exclusion>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>janino</artifactId>
> >>> </exclusion>
> >>> <exclusion>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>commons-compiler</artifactId>
> >>> </exclusion>
> >>> </exclusions>
> >>> </dependency>
> >>>
> >>> <dependency>
> >>> <groupId>org.apache.calcite</groupId>
> >>> <artifactId>calcite-file</artifactId>
> >>> <version>1.29.0</version>
> >>> <exclusions>
> >>> <exclusion>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>janino</artifactId>
> >>> </exclusion>
> >>> <exclusion>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>commons-compiler</artifactId>
> >>> </exclusion>
> >>> </exclusions>
> >>> </dependency>
> >>>
> >>> <dependency>
> >>> <groupId>org.apache.calcite</groupId>
> >>> <artifactId>calcite-example-csv</artifactId>
> >>> <version>1.21.0</version>
> >>> <exclusions>
> >>> <exclusion>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>janino</artifactId>
> >>> </exclusion>
> >>> <exclusion>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>commons-compiler</artifactId>
> >>> </exclusion>
> >>> </exclusions>
> >>> </dependency>
> >>>
> >>> <dependency>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>janino</artifactId>
> >>> <version>3.1.6</version>
> >>> </dependency>
> >>>
> >>> <dependency>
> >>> <groupId>org.codehaus.janino</groupId>
> >>> <artifactId>commons-compiler</artifactId>
> >>> <version>3.1.6</version>
> >>> </dependency>
> >>> </dependencies>
> >>>
> >>>
> >>> On Fri, Feb 25, 2022 at 9:33 AM xiaobo <gu...@qq.com.invalid>
> >>> wrote:
> >>>
> >>>> I have put the testing code at github
> >>>>
> >>>>
> >>>>
> https://github.com/guxiaobo/gxb-testing/blob/main/calcite-testing/src/test/java/com/xsmartware/testing/calcite/Test1.java
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ------------------ Original ------------------
> >>>> From:  "xiaobo ";<gu...@qq.com>;
> >>>> Send time: Friday, Feb 25, 2022 9:05 PM
> >>>> To: "dev"<de...@calcite.apache.org>;
> >>>>
> >>>> Subject:  Re:        calcite multi-threading problem
> >>>>
> >>>>
> >>>>
> >>>> Hi,
> >>>> Now we come to the  problem similar as the one at
> >>>> https://github.com/apache/calcite/pull/2433#issuecomment-860024076,
> >>>>
> >>>> a simple sql "select max(id) from s.t1" caused the following
> exception,
> >>>> users report upgrading janino to 3.1.6 can fix this problem, but as we
> >>>> discussed before janino 3.1.6 is not fully compatible with calcite
> 1.29.0
> >>>> because of the dependency issue.
> >>>>
> >>>>
> >>>>
> >>>>       at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
> >>>> ~[avatica-core-1.20.0.jar:1.20.0]
> >>>>       at
> >>>>
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepare_(CalcitePrepareImpl.java:1032)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepareRel(CalcitePrepareImpl.java:988)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:668)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       ... 13 common frames omitted
> >>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> >>>> Compiling "Baz" in File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 1,
> >>>> Column 1: File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 41,
> >>>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 60,
> >>>> Column 64
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:369)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52)
> >>>> ~[commons-compiler-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       at
> >>>>
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127)
> >>>> ~[calcite-core-1.29.0.jar:1.29.0]
> >>>>       ... 21 common frames omitted
> >>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 41,
> >>>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 60,
> >>>> Column 64
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       ... 34 common frames omitted
> >>>> Caused by: java.lang.RuntimeException: File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 60,
> >>>> Column 64
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2639)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       ... 44 common frames omitted
> >>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 60,
> >>>> Column 80: Compiling "new
> >>>> org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory(new
> >>>> org.apache.calcite.linq4j.function.Function0() { ... },
> >>>> accumulatorAdders)": File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 61,
> >>>> Column 5: Compiling "new
> org.apache.calcite.linq4j.function.Function0() {
> >>>> ... }": File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 62,
> >>>> Column 21: Compiling "apply()": File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 70,
> >>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException:
> Operand
> >>>> stack underflow
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       ... 52 common frames omitted
> >>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 61,
> >>>> Column 5: Compiling "new
> org.apache.calcite.linq4j.function.Function0() {
> >>>> ... }": File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 62,
> >>>> Column 21: Compiling "apply()": File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 70,
> >>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException:
> Operand
> >>>> stack underflow
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:8297)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5468)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$9700(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4643)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4604)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.Java$NewClassInstance.accept(Java.java:5560)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       ... 53 common frames omitted
> >>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 62,
> >>>> Column 21: Compiling "apply()": File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 70,
> >>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException:
> Operand
> >>>> stack underflow
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:977)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:947)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:389)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:386)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1375)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5571)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$9400(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4640)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4604)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5608)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       ... 61 common frames omitted
> >>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> File
> >>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line
> 70,
> >>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException:
> Operand
> >>>> stack underflow
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2393)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1530)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1523)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:3198)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       ... 78 common frames omitted
> >>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> >>>> Operand stack underflow
> >>>>       at org.codehaus.janino.StackMap.peekOperand(StackMap.java:94)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.CodeContext.popOperand(CodeContext.java:1349)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.putfield(UnitCompiler.java:12363)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6498)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$13400(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6480)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6475)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at org.codehaus.janino.Java$FieldAccess.accept(Java.java:4668)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6489)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$13200(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6478)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6475)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:4574)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3992)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.access$6000(UnitCompiler.java:231)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3944)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>>
> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3924)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at org.codehaus.janino.Java$Assignment.accept(Java.java:4835)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3924)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       at
> >>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2391)
> >>>> ~[janino-3.1.4.jar:na]
> >>>>       ... 86 common frames omitted
> >>>>
> >>>> With janino 3.1.4
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ------------------ Original ------------------
> >>>> From:  "xiaobo ";<gu...@qq.com>;
> >>>> Send time: Saturday, Feb 12, 2022 9:14 PM
> >>>> To: "dev"<de...@calcite.apache.org>;
> >>>>
> >>>> Subject:  Re:       calcite multi-threading problem
> >>>>
> >>>>
> >>>>
> >>>> 3.1.4 of janino and commons-compiler works now.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ------------------ Original ------------------
> >>>> From:  "xiaobo ";<gu...@qq.com>;
> >>>> Send time: Saturday, Feb 12, 2022 8:04 PM
> >>>> To: "dev"<de...@calcite.apache.org>;
> >>>>
> >>>> Subject:  Re:      calcite multi-threading problem
> >>>>
> >>>>
> >>>>
> >>>> but strange enough, the same code works in a single thread.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ------------------ Original ------------------
> >>>> From:  "xiaobo ";<gu...@qq.com>;
> >>>> Send time: Saturday, Feb 12, 2022 8:02 PM
> >>>> To: "dev"<de...@calcite.apache.org>;
> >>>>
> >>>> Subject:  Re:     calcite multi-threading problem
> >>>>
> >>>>
> >>>>
> >>>> we checked the janino release note page
> >>>> http://janino-compiler.github.io/janino/changelog.html
> >>>>
> >>>> Fixed issue #141: Unable to find
> org.codehaus.commons.compiler.properties
> >>>> in java 11: ICompilerFactories were loaded through the current
> thread's
> >>>> "context class loader", which is a bad choice in some environments.
> Thus,
> >>>> the methods "getDefaultCompilerFactory()",
> "getAllCompilerFactories()" and
> >>>> "getCompilerFactory(className)" were duplicated and augmented with a
> >>>> "classLoader" parameter.
> >>>>
> >>>> what does this mean?  the getDefaultCompilerFactory method with a
> >>>> classloader parameter was removed intentionally?
> >>>> but it seems calcite still needs it , so what version of janino
> should we
> >>>> use for the latest calcite-core?
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ------------------ Original ------------------
> >>>> From:  "xiaobo ";<gu...@qq.com>;
> >>>> Send time: Saturday, Feb 12, 2022 12:01 PM
> >>>> To: "dev"<de...@calcite.apache.org>;
> >>>>
> >>>> Subject:  Re:    calcite multi-threading problem
> >>>>
> >>>>
> >>>>
> >>>> In our use case, the Java class which opens calcite connection is
> >>>> contained in a external Java jar file, which is loaded dynamicly
> through
> >>>> classloaders other than the default systemloader like this:
> >>>>
> >>>>
> >>>> try {
> >>>>           ClassLoader loader = URLClassLoader.newInstance(
> >>>>                   new URL[] { new URL("jar:file:" + path + "!/") },
> >>>>                   getClass().getClassLoader());
> >>>>           Class<?> clazz = Class.forName(classPath, true, loader);
> >>>>
> >>>> we mention this because the error message shows a classloader
> parameter.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ------------------ Original ------------------
> >>>> From:  "xiaobo ";<gu...@qq.com>;
> >>>> Send time: Saturday, Feb 12, 2022 11:56 AM
> >>>> To: "dev"<de...@calcite.apache.org>;
> >>>>
> >>>> Subject:  Re:   calcite multi-threading problem
> >>>>
> >>>>
> >>>>
> >>>> And if we remove calcite from our project,  janino is not in "resolved
> >>>> depencies" library list of pom.xml,
> >>>> So we think it not the janino conflic problem.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ------------------ Original ------------------
> >>>> From:  "xiaobo ";<gu...@qq.com>;
> >>>> Send time: Saturday, Feb 12, 2022 9:49 AM
> >>>> To: "dev"<de...@calcite.apache.org>;
> >>>>
> >>>> Subject:  Re:  calcite multi-threading problem
> >>>>
> >>>>
> >>>>
> >>>> can you share the solution for the problem, we are using the following
> >>>> libraries, and it seems janino 3.1.6  is only dependent by
> calcite-core.
> >>>>
> >>>>   <properties>
> >>>>
> >>>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> >>>>         <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
> >>>>         <java.version>9</java.version>
> >>>>         <maven.compiler.source>9</maven.compiler.source>
> >>>>         <maven.compiler.target>9</maven.compiler.target>
> >>>>       <log4j2.version>2.17.1</log4j2.version>
> >>>>       <drools.version>7.64.0.Final</drools.version>
> >>>>  </properties>
> >>>>
> >>>> <groupId>org.apache.calcite</groupId>
> >>>>           <artifactId>calcite-core</artifactId>
> >>>>           <version>1.29.0</version>
> >>>>       </dependency>
> >>>>       <dependency>
> >>>>           <groupId>org.apache.calcite.avatica</groupId>
> >>>>           <artifactId>avatica-core</artifactId>
> >>>>           <version>1.20.0</version>
> >>>>       </dependency>
> >>>>
> >>>>
> >>>>   <dependency>
> >>>>           <groupId>org.drools</groupId>
> >>>>           <artifactId>drools-core</artifactId>
> >>>>           <version>${drools.version}</version>
> >>>>       </dependency>
> >>>>       <dependency>
> >>>>           <groupId>org.drools</groupId>
> >>>>           <artifactId>drools-compiler</artifactId>
> >>>>           <version>${drools.version}</version>
> >>>>       </dependency>
> >>>>       <dependency>
> >>>>           <groupId>org.drools</groupId>
> >>>>           <artifactId>drools-decisiontables</artifactId>
> >>>>           <version>${drools.version}</version>
> >>>>       </dependency>
> >>>>
> >>>>
> >>>> ------------------ Original ------------------
> >>>> From:  "xiong duan";<no...@gmail.com>;
> >>>> Send time: Saturday, Feb 12, 2022 8:43 AM
> >>>> To: "dev"<de...@calcite.apache.org>;
> >>>>
> >>>> Subject:  Re: calcite multi-threading problem
> >>>>
> >>>>
> >>>>
> >>>> Yes, It is a dependency issue. I have met the same problem. +1 for
> Dmitry.
> >>>>
> >>>> Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
> >>>>
> >>>>> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> >>>>> version of janino, calcite 1.29 uses the new version of janino and
> they
> >>>> are
> >>>>> not compatible.
> >>>>> If I downgrade janino version to version which spark uses I got an
> error
> >>>>> not method found exception
> >>>>> If I upgrade the janino version to the version which calcite uses I
> get
> >>>> the
> >>>>> same error but with another method.
> >>>>>
> >>>>> As a result, I built a separate calcite jar package where I shaded
> >>>> janino
> >>>>> dependency
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> >>>>> estanilovskiy@gridgain.com> wrote:
> >>>>>
> >>>>>> for example on a current calcite branch:
> >>>>>> grep janino gradle.properties
> >>>>>> janino.version=3.1.6
> >>>>>>
> >>>>>>
> >>>>>>> yes, we use drools in the same project,&nbsp; and drools uses
> janino
> >>>>>>> too, is there a version list of janino which calcite supports?
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> ---Original---
> >>>>>>> From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> >>>>>>> Date: Fri, Feb 11, 2022 18:30 PM
> >>>>>>> To: "dev"<dev@calcite.apache.org&gt;;
> >>>>>>> Subject: Re: calcite multi-threading problem
> >>>>>>>
> >>>>>>>
> >>>>>>> Hi!
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> >>>>>>> calcite&nbsp;requires&nbsp;another&nbsp;one
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> >>>>>> &gt;&nbsp;wrote:
> >>>>>>>
> >>>>>>> &gt;&nbsp;Hi,
> >>>>>>> &gt;
> >>>>>>> &gt;
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> >>>>>>> &gt;&nbsp;this&nbsp;error
> >>>>>>> &gt;
> >>>>>>> &gt;
> >>>>>>> &gt;
> >>>>>>> &gt;
> >>>>>>> &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> >>>>>>> &gt;&nbsp;java.lang.NoSuchMethodError:
> >>>>>>> &gt;
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> >>>>>>> &gt;
> >>>>>>> &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> >>>>>>> &gt;
> >>>>>>> &gt;
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >>>>>>
> >>>>>
> >>>
>
>

Re: calcite multi-threading problem

Posted by Julian Hyde <jh...@gmail.com>.
To repeat, it would help if there were a Jira case. I don’t want to debug problems with janino 3.1.6 unless I know why we’re upgrading to 3.1.6. Also, we have a duty to reduce volume on the dev list.

> On Feb 25, 2022, at 7:19 PM, xiaobo <gu...@qq.com.INVALID> wrote:
> 
> Hi Gavin and Julian,
> Thanks for your help, we know that upgrading janino and common compiler to 3.1.6 will fix the "operand stack underflow" error, but we have also have problem with 3.1.6 of janino as mentioned before:
> ----------------------
> 
> we checked the janino release note page
> http://janino-compiler.github.io/janino/changelog.html
> 
> Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some environments. Thus, the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and "getCompilerFactory(className)" were duplicated and augmented with a "classLoader" parameter. 
> 
> what does this mean?  the getDefaultCompilerFactory method with a classloader parameter was removed intentionally?
> but it seems calcite still needs it .
> --------------------
> 
> 
> What we mean here is that we think calcite has a bug with janino 3.1.6 , are we right?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ------------------ Original ------------------
> From:  "Julian Hyde";<jh...@gmail.com>;
> Send time: Saturday, Feb 26, 2022 1:24 AM
> To: "dev"<de...@calcite.apache.org>; 
> 
> Subject:  Re: calcite multi-threading problem
> 
> 
> 
> Should a jira case be logged for this issue? Or is there an existing case? If the latter, should we add a stack trace to help people tie it to this problem?
> 
> A jira URL in this thread will help other people who run into this problem in future. Right now it is just a rambling email thread with an off-topic subject.
> 
> Julian
> 
>> On Feb 25, 2022, at 7:18 AM, Gavin Ray <ra...@gmail.com> wrote:
>> 
>> Also I just checked and this is updated on master so it should be solved in
>> next release FWIW:
>> 
>> https://github.com/apache/calcite/blob/cbbe5701b7f61d7f8df12d314ba5aabf898c1cae/gradle.properties#L116
>> 
>>> On Fri, Feb 25, 2022 at 10:16 AM Gavin Ray <ra...@gmail.com> wrote:
>>> 
>>> The fix for this is just to add janino and commons-compiler as exclusions
>>> in the calcite/avatica dependencies
>>> And then add the updated version so that it overwrites them
>>> 
>>> I tested this on your code and it worked
>>> 
>>> Also, please listen to Stamatis/Julian advice
>>> 
>>> <dependencies>
>>> <dependency>
>>> <groupId>org.apache.calcite</groupId>
>>> <artifactId>calcite-core</artifactId>
>>> <version>1.29.0</version>
>>> <exclusions>
>>> <exclusion>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>janino</artifactId>
>>> </exclusion>
>>> <exclusion>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>commons-compiler</artifactId>
>>> </exclusion>
>>> </exclusions>
>>> </dependency>
>>> 
>>> <dependency>
>>> <groupId>org.apache.calcite.avatica</groupId>
>>> <artifactId>avatica-core</artifactId>
>>> <version>1.20.0</version>
>>> <exclusions>
>>> <exclusion>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>janino</artifactId>
>>> </exclusion>
>>> <exclusion>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>commons-compiler</artifactId>
>>> </exclusion>
>>> </exclusions>
>>> </dependency>
>>> 
>>> <dependency>
>>> <groupId>org.apache.calcite</groupId>
>>> <artifactId>calcite-file</artifactId>
>>> <version>1.29.0</version>
>>> <exclusions>
>>> <exclusion>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>janino</artifactId>
>>> </exclusion>
>>> <exclusion>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>commons-compiler</artifactId>
>>> </exclusion>
>>> </exclusions>
>>> </dependency>
>>> 
>>> <dependency>
>>> <groupId>org.apache.calcite</groupId>
>>> <artifactId>calcite-example-csv</artifactId>
>>> <version>1.21.0</version>
>>> <exclusions>
>>> <exclusion>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>janino</artifactId>
>>> </exclusion>
>>> <exclusion>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>commons-compiler</artifactId>
>>> </exclusion>
>>> </exclusions>
>>> </dependency>
>>> 
>>> <dependency>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>janino</artifactId>
>>> <version>3.1.6</version>
>>> </dependency>
>>> 
>>> <dependency>
>>> <groupId>org.codehaus.janino</groupId>
>>> <artifactId>commons-compiler</artifactId>
>>> <version>3.1.6</version>
>>> </dependency>
>>> </dependencies>
>>> 
>>> 
>>> On Fri, Feb 25, 2022 at 9:33 AM xiaobo <gu...@qq.com.invalid>
>>> wrote:
>>> 
>>>> I have put the testing code at github
>>>> 
>>>> 
>>>> https://github.com/guxiaobo/gxb-testing/blob/main/calcite-testing/src/test/java/com/xsmartware/testing/calcite/Test1.java
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ------------------ Original ------------------
>>>> From:  "xiaobo ";<gu...@qq.com>;
>>>> Send time: Friday, Feb 25, 2022 9:05 PM
>>>> To: "dev"<de...@calcite.apache.org>;
>>>> 
>>>> Subject:  Re:        calcite multi-threading problem
>>>> 
>>>> 
>>>> 
>>>> Hi,
>>>> Now we come to the  problem similar as the one at
>>>> https://github.com/apache/calcite/pull/2433#issuecomment-860024076,
>>>> 
>>>> a simple sql "select max(id) from s.t1" caused the following exception,
>>>> users report upgrading janino to 3.1.6 can fix this problem, but as we
>>>> discussed before janino 3.1.6 is not fully compatible with calcite 1.29.0
>>>> because of the dependency issue.
>>>> 
>>>> 
>>>> 
>>>>       at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
>>>> ~[avatica-core-1.20.0.jar:1.20.0]
>>>>       at
>>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepare_(CalcitePrepareImpl.java:1032)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepareRel(CalcitePrepareImpl.java:988)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:668)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       ... 13 common frames omitted
>>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
>>>> Compiling "Baz" in File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 1,
>>>> Column 1: File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
>>>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>>> Column 64
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:369)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52)
>>>> ~[commons-compiler-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       at
>>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127)
>>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>>       ... 21 common frames omitted
>>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
>>>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>>> Column 64
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359)
>>>> ~[janino-3.1.4.jar:na]
>>>>       ... 34 common frames omitted
>>>> Caused by: java.lang.RuntimeException: File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>>> Column 64
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2639)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
>>>> ~[janino-3.1.4.jar:na]
>>>>       ... 44 common frames omitted
>>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>>> Column 80: Compiling "new
>>>> org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory(new
>>>> org.apache.calcite.linq4j.function.Function0() { ... },
>>>> accumulatorAdders)": File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
>>>> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
>>>> ... }": File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>>> Column 21: Compiling "apply()": File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>>> stack underflow
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622)
>>>> ~[janino-3.1.4.jar:na]
>>>>       ... 52 common frames omitted
>>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
>>>> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
>>>> ... }": File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>>> Column 21: Compiling "apply()": File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>>> stack underflow
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:8297)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5468)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$9700(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4643)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4604)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.Java$NewClassInstance.accept(Java.java:5560)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
>>>> ~[janino-3.1.4.jar:na]
>>>>       ... 53 common frames omitted
>>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>>> Column 21: Compiling "apply()": File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>>> stack underflow
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:977)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:947)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:389)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:386)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1375)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5571)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$9400(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4640)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4604)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5608)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
>>>> ~[janino-3.1.4.jar:na]
>>>>       ... 61 common frames omitted
>>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>>> stack underflow
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2393)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1530)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1523)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:3198)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
>>>> ~[janino-3.1.4.jar:na]
>>>>       ... 78 common frames omitted
>>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
>>>> Operand stack underflow
>>>>       at org.codehaus.janino.StackMap.peekOperand(StackMap.java:94)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.CodeContext.popOperand(CodeContext.java:1349)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.putfield(UnitCompiler.java:12363)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6498)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$13400(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6480)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6475)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at org.codehaus.janino.Java$FieldAccess.accept(Java.java:4668)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6489)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$13200(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6478)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6475)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:4574)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3992)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.access$6000(UnitCompiler.java:231)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3944)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3924)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at org.codehaus.janino.Java$Assignment.accept(Java.java:4835)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3924)
>>>> ~[janino-3.1.4.jar:na]
>>>>       at
>>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2391)
>>>> ~[janino-3.1.4.jar:na]
>>>>       ... 86 common frames omitted
>>>> 
>>>> With janino 3.1.4
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ------------------ Original ------------------
>>>> From:  "xiaobo ";<gu...@qq.com>;
>>>> Send time: Saturday, Feb 12, 2022 9:14 PM
>>>> To: "dev"<de...@calcite.apache.org>;
>>>> 
>>>> Subject:  Re:       calcite multi-threading problem
>>>> 
>>>> 
>>>> 
>>>> 3.1.4 of janino and commons-compiler works now.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ------------------ Original ------------------
>>>> From:  "xiaobo ";<gu...@qq.com>;
>>>> Send time: Saturday, Feb 12, 2022 8:04 PM
>>>> To: "dev"<de...@calcite.apache.org>;
>>>> 
>>>> Subject:  Re:      calcite multi-threading problem
>>>> 
>>>> 
>>>> 
>>>> but strange enough, the same code works in a single thread.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ------------------ Original ------------------
>>>> From:  "xiaobo ";<gu...@qq.com>;
>>>> Send time: Saturday, Feb 12, 2022 8:02 PM
>>>> To: "dev"<de...@calcite.apache.org>;
>>>> 
>>>> Subject:  Re:     calcite multi-threading problem
>>>> 
>>>> 
>>>> 
>>>> we checked the janino release note page
>>>> http://janino-compiler.github.io/janino/changelog.html
>>>> 
>>>> Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties
>>>> in java 11: ICompilerFactories were loaded through the current thread's
>>>> "context class loader", which is a bad choice in some environments. Thus,
>>>> the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and
>>>> "getCompilerFactory(className)" were duplicated and augmented with a
>>>> "classLoader" parameter.
>>>> 
>>>> what does this mean?  the getDefaultCompilerFactory method with a
>>>> classloader parameter was removed intentionally?
>>>> but it seems calcite still needs it , so what version of janino should we
>>>> use for the latest calcite-core?
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ------------------ Original ------------------
>>>> From:  "xiaobo ";<gu...@qq.com>;
>>>> Send time: Saturday, Feb 12, 2022 12:01 PM
>>>> To: "dev"<de...@calcite.apache.org>;
>>>> 
>>>> Subject:  Re:    calcite multi-threading problem
>>>> 
>>>> 
>>>> 
>>>> In our use case, the Java class which opens calcite connection is
>>>> contained in a external Java jar file, which is loaded dynamicly through
>>>> classloaders other than the default systemloader like this:
>>>> 
>>>> 
>>>> try {
>>>>           ClassLoader loader = URLClassLoader.newInstance(
>>>>                   new URL[] { new URL("jar:file:" + path + "!/") },
>>>>                   getClass().getClassLoader());
>>>>           Class<?> clazz = Class.forName(classPath, true, loader);
>>>> 
>>>> we mention this because the error message shows a classloader parameter.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ------------------ Original ------------------
>>>> From:  "xiaobo ";<gu...@qq.com>;
>>>> Send time: Saturday, Feb 12, 2022 11:56 AM
>>>> To: "dev"<de...@calcite.apache.org>;
>>>> 
>>>> Subject:  Re:   calcite multi-threading problem
>>>> 
>>>> 
>>>> 
>>>> And if we remove calcite from our project,  janino is not in "resolved
>>>> depencies" library list of pom.xml,
>>>> So we think it not the janino conflic problem.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ------------------ Original ------------------
>>>> From:  "xiaobo ";<gu...@qq.com>;
>>>> Send time: Saturday, Feb 12, 2022 9:49 AM
>>>> To: "dev"<de...@calcite.apache.org>;
>>>> 
>>>> Subject:  Re:  calcite multi-threading problem
>>>> 
>>>> 
>>>> 
>>>> can you share the solution for the problem, we are using the following
>>>> libraries, and it seems janino 3.1.6  is only dependent by calcite-core.
>>>> 
>>>>   <properties>
>>>> 
>>>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>>>>         <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
>>>>         <java.version>9</java.version>
>>>>         <maven.compiler.source>9</maven.compiler.source>
>>>>         <maven.compiler.target>9</maven.compiler.target>
>>>>       <log4j2.version>2.17.1</log4j2.version>
>>>>       <drools.version>7.64.0.Final</drools.version>
>>>>  </properties>
>>>> 
>>>> <groupId>org.apache.calcite</groupId>
>>>>           <artifactId>calcite-core</artifactId>
>>>>           <version>1.29.0</version>
>>>>       </dependency>
>>>>       <dependency>
>>>>           <groupId>org.apache.calcite.avatica</groupId>
>>>>           <artifactId>avatica-core</artifactId>
>>>>           <version>1.20.0</version>
>>>>       </dependency>
>>>> 
>>>> 
>>>>   <dependency>
>>>>           <groupId>org.drools</groupId>
>>>>           <artifactId>drools-core</artifactId>
>>>>           <version>${drools.version}</version>
>>>>       </dependency>
>>>>       <dependency>
>>>>           <groupId>org.drools</groupId>
>>>>           <artifactId>drools-compiler</artifactId>
>>>>           <version>${drools.version}</version>
>>>>       </dependency>
>>>>       <dependency>
>>>>           <groupId>org.drools</groupId>
>>>>           <artifactId>drools-decisiontables</artifactId>
>>>>           <version>${drools.version}</version>
>>>>       </dependency>
>>>> 
>>>> 
>>>> ------------------ Original ------------------
>>>> From:  "xiong duan";<no...@gmail.com>;
>>>> Send time: Saturday, Feb 12, 2022 8:43 AM
>>>> To: "dev"<de...@calcite.apache.org>;
>>>> 
>>>> Subject:  Re: calcite multi-threading problem
>>>> 
>>>> 
>>>> 
>>>> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
>>>> 
>>>> Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
>>>> 
>>>>> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
>>>>> version of janino, calcite 1.29 uses the new version of janino and they
>>>> are
>>>>> not compatible.
>>>>> If I downgrade janino version to version which spark uses I got an error
>>>>> not method found exception
>>>>> If I upgrade the janino version to the version which calcite uses I get
>>>> the
>>>>> same error but with another method.
>>>>> 
>>>>> As a result, I built a separate calcite jar package where I shaded
>>>> janino
>>>>> dependency
>>>>> 
>>>>> 
>>>>> 
>>>>> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
>>>>> estanilovskiy@gridgain.com> wrote:
>>>>> 
>>>>>> for example on a current calcite branch:
>>>>>> grep janino gradle.properties
>>>>>> janino.version=3.1.6
>>>>>> 
>>>>>> 
>>>>>>> yes, we use drools in the same project,&nbsp; and drools uses janino
>>>>>>> too, is there a version list of janino which calcite supports?
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> ---Original---
>>>>>>> From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
>>>>>>> Date: Fri, Feb 11, 2022 18:30 PM
>>>>>>> To: "dev"<dev@calcite.apache.org&gt;;
>>>>>>> Subject: Re: calcite multi-threading problem
>>>>>>> 
>>>>>>> 
>>>>>>> Hi!
>>>>>>> 
>>>>>> 
>>>>> 
>>>> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
>>>>>>> 
>>>>>> 
>>>>> 
>>>> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
>>>>>>> calcite&nbsp;requires&nbsp;another&nbsp;one
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
>>>>>> &gt;&nbsp;wrote:
>>>>>>> 
>>>>>>> &gt;&nbsp;Hi,
>>>>>>> &gt;
>>>>>>> &gt;
>>>>>>> 
>>>>>> 
>>>>> 
>>>> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
>>>>>>> 
>>>>>> 
>>>>> 
>>>> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
>>>>>>> &gt;&nbsp;this&nbsp;error
>>>>>>> &gt;
>>>>>>> &gt;
>>>>>>> &gt;
>>>>>>> &gt;
>>>>>>> &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
>>>>>>> &gt;&nbsp;java.lang.NoSuchMethodError:
>>>>>>> &gt;
>>>>>>> 
>>>>>> 
>>>>> 
>>>> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
>>>>>>> &gt;
>>>>>>> &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
>>>>>>> &gt;
>>>>>>> &gt;
>>>>>>> 
>>>>>> 
>>>>> 
>>>> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
>>>>>> 
>>>>> 
>>> 


Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
Hi Gavin and Julian,
Thanks for your help, we know that upgrading janino and common compiler to 3.1.6 will fix the "operand stack underflow" error, but we have also have problem with 3.1.6 of janino as mentioned before:
----------------------

we checked the janino release note page
http://janino-compiler.github.io/janino/changelog.html

Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some environments. Thus, the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and "getCompilerFactory(className)" were duplicated and augmented with a "classLoader" parameter. 

what does this mean?  the getDefaultCompilerFactory method with a classloader parameter was removed intentionally?
but it seems calcite still needs it .
--------------------


What we mean here is that we think calcite has a bug with janino 3.1.6 , are we right?










------------------ Original ------------------
From:  "Julian Hyde";<jh...@gmail.com>;
Send time: Saturday, Feb 26, 2022 1:24 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Should a jira case be logged for this issue? Or is there an existing case? If the latter, should we add a stack trace to help people tie it to this problem?

A jira URL in this thread will help other people who run into this problem in future. Right now it is just a rambling email thread with an off-topic subject.

Julian

> On Feb 25, 2022, at 7:18 AM, Gavin Ray <ra...@gmail.com> wrote:
> 
> Also I just checked and this is updated on master so it should be solved in
> next release FWIW:
> 
> https://github.com/apache/calcite/blob/cbbe5701b7f61d7f8df12d314ba5aabf898c1cae/gradle.properties#L116
> 
>> On Fri, Feb 25, 2022 at 10:16 AM Gavin Ray <ra...@gmail.com> wrote:
>> 
>> The fix for this is just to add janino and commons-compiler as exclusions
>> in the calcite/avatica dependencies
>> And then add the updated version so that it overwrites them
>> 
>> I tested this on your code and it worked
>> 
>> Also, please listen to Stamatis/Julian advice
>> 
>> <dependencies>
>> <dependency>
>> <groupId>org.apache.calcite</groupId>
>> <artifactId>calcite-core</artifactId>
>> <version>1.29.0</version>
>> <exclusions>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> </exclusion>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> </exclusion>
>> </exclusions>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.apache.calcite.avatica</groupId>
>> <artifactId>avatica-core</artifactId>
>> <version>1.20.0</version>
>> <exclusions>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> </exclusion>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> </exclusion>
>> </exclusions>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.apache.calcite</groupId>
>> <artifactId>calcite-file</artifactId>
>> <version>1.29.0</version>
>> <exclusions>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> </exclusion>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> </exclusion>
>> </exclusions>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.apache.calcite</groupId>
>> <artifactId>calcite-example-csv</artifactId>
>> <version>1.21.0</version>
>> <exclusions>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> </exclusion>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> </exclusion>
>> </exclusions>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> <version>3.1.6</version>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> <version>3.1.6</version>
>> </dependency>
>> </dependencies>
>> 
>> 
>> On Fri, Feb 25, 2022 at 9:33 AM xiaobo <gu...@qq.com.invalid>
>> wrote:
>> 
>>> I have put the testing code at github
>>> 
>>> 
>>> https://github.com/guxiaobo/gxb-testing/blob/main/calcite-testing/src/test/java/com/xsmartware/testing/calcite/Test1.java
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Friday, Feb 25, 2022 9:05 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:        calcite multi-threading problem
>>> 
>>> 
>>> 
>>> Hi,
>>> Now we come to the  problem similar as the one at
>>> https://github.com/apache/calcite/pull/2433#issuecomment-860024076,
>>> 
>>> a simple sql "select max(id) from s.t1" caused the following exception,
>>> users report upgrading janino to 3.1.6 can fix this problem, but as we
>>> discussed before janino 3.1.6 is not fully compatible with calcite 1.29.0
>>> because of the dependency issue.
>>> 
>>> 
>>> 
>>>        at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
>>> ~[avatica-core-1.20.0.jar:1.20.0]
>>>        at
>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepare_(CalcitePrepareImpl.java:1032)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepareRel(CalcitePrepareImpl.java:988)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:668)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        ... 13 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
>>> Compiling "Baz" in File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 1,
>>> Column 1: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
>>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>> Column 64
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:369)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52)
>>> ~[commons-compiler-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        ... 21 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
>>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>> Column 64
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 34 common frames omitted
>>> Caused by: java.lang.RuntimeException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>> Column 64
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2639)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 44 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>> Column 80: Compiling "new
>>> org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory(new
>>> org.apache.calcite.linq4j.function.Function0() { ... },
>>> accumulatorAdders)": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
>>> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
>>> ... }": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>> Column 21: Compiling "apply()": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>> stack underflow
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 52 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
>>> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
>>> ... }": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>> Column 21: Compiling "apply()": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>> stack underflow
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:8297)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5468)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$9700(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4643)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4604)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$NewClassInstance.accept(Java.java:5560)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 53 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>> Column 21: Compiling "apply()": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>> stack underflow
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:977)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:947)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:389)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:386)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1375)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5571)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$9400(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4640)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4604)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5608)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 61 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>> stack underflow
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2393)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1530)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1523)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:3198)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 78 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
>>> Operand stack underflow
>>>        at org.codehaus.janino.StackMap.peekOperand(StackMap.java:94)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.CodeContext.popOperand(CodeContext.java:1349)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.putfield(UnitCompiler.java:12363)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6498)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$13400(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6480)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6475)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.janino.Java$FieldAccess.accept(Java.java:4668)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6489)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$13200(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6478)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6475)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:4574)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3992)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$6000(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3944)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3924)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.janino.Java$Assignment.accept(Java.java:4835)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3924)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2391)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 86 common frames omitted
>>> 
>>> With janino 3.1.4
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 9:14 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:       calcite multi-threading problem
>>> 
>>> 
>>> 
>>> 3.1.4 of janino and commons-compiler works now.
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 8:04 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:      calcite multi-threading problem
>>> 
>>> 
>>> 
>>> but strange enough, the same code works in a single thread.
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 8:02 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:     calcite multi-threading problem
>>> 
>>> 
>>> 
>>> we checked the janino release note page
>>> http://janino-compiler.github.io/janino/changelog.html
>>> 
>>> Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties
>>> in java 11: ICompilerFactories were loaded through the current thread's
>>> "context class loader", which is a bad choice in some environments. Thus,
>>> the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and
>>> "getCompilerFactory(className)" were duplicated and augmented with a
>>> "classLoader" parameter.
>>> 
>>> what does this mean?  the getDefaultCompilerFactory method with a
>>> classloader parameter was removed intentionally?
>>> but it seems calcite still needs it , so what version of janino should we
>>> use for the latest calcite-core?
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 12:01 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:    calcite multi-threading problem
>>> 
>>> 
>>> 
>>> In our use case, the Java class which opens calcite connection is
>>> contained in a external Java jar file, which is loaded dynamicly through
>>> classloaders other than the default systemloader like this:
>>> 
>>> 
>>> try {
>>>            ClassLoader loader = URLClassLoader.newInstance(
>>>                    new URL[] { new URL("jar:file:" + path + "!/") },
>>>                    getClass().getClassLoader());
>>>            Class<?> clazz = Class.forName(classPath, true, loader);
>>> 
>>> we mention this because the error message shows a classloader parameter.
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 11:56 AM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:   calcite multi-threading problem
>>> 
>>> 
>>> 
>>> And if we remove calcite from our project,  janino is not in "resolved
>>> depencies" library list of pom.xml,
>>> So we think it not the janino conflic problem.
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 9:49 AM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:  calcite multi-threading problem
>>> 
>>> 
>>> 
>>> can you share the solution for the problem, we are using the following
>>> libraries, and it seems janino 3.1.6  is only dependent by calcite-core.
>>> 
>>>    <properties>
>>> 
>>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>>>          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
>>>          <java.version>9</java.version>
>>>          <maven.compiler.source>9</maven.compiler.source>
>>>          <maven.compiler.target>9</maven.compiler.target>
>>>        <log4j2.version>2.17.1</log4j2.version>
>>>        <drools.version>7.64.0.Final</drools.version>
>>>   </properties>
>>> 
>>> <groupId>org.apache.calcite</groupId>
>>>            <artifactId>calcite-core</artifactId>
>>>            <version>1.29.0</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.apache.calcite.avatica</groupId>
>>>            <artifactId>avatica-core</artifactId>
>>>            <version>1.20.0</version>
>>>        </dependency>
>>> 
>>> 
>>>    <dependency>
>>>            <groupId>org.drools</groupId>
>>>            <artifactId>drools-core</artifactId>
>>>            <version>${drools.version}</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.drools</groupId>
>>>            <artifactId>drools-compiler</artifactId>
>>>            <version>${drools.version}</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.drools</groupId>
>>>            <artifactId>drools-decisiontables</artifactId>
>>>            <version>${drools.version}</version>
>>>        </dependency>
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiong duan";<no...@gmail.com>;
>>> Send time: Saturday, Feb 12, 2022 8:43 AM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re: calcite multi-threading problem
>>> 
>>> 
>>> 
>>> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
>>> 
>>> Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
>>> 
>>>> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
>>>> version of janino, calcite 1.29 uses the new version of janino and they
>>> are
>>>> not compatible.
>>>> If I downgrade janino version to version which spark uses I got an error
>>>> not method found exception
>>>> If I upgrade the janino version to the version which calcite uses I get
>>> the
>>>> same error but with another method.
>>>> 
>>>> As a result, I built a separate calcite jar package where I shaded
>>> janino
>>>> dependency
>>>> 
>>>> 
>>>> 
>>>> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
>>>> estanilovskiy@gridgain.com> wrote:
>>>> 
>>>>> for example on a current calcite branch:
>>>>> grep janino gradle.properties
>>>>> janino.version=3.1.6
>>>>> 
>>>>> 
>>>>>> yes, we use drools in the same project,&nbsp; and drools uses janino
>>>>>> too, is there a version list of janino which calcite supports?
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---Original---
>>>>>> From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
>>>>>> Date: Fri, Feb 11, 2022 18:30 PM
>>>>>> To: "dev"<dev@calcite.apache.org&gt;;
>>>>>> Subject: Re: calcite multi-threading problem
>>>>>> 
>>>>>> 
>>>>>> Hi!
>>>>>> 
>>>>> 
>>>> 
>>> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
>>>>>> 
>>>>> 
>>>> 
>>> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
>>>>>> calcite&nbsp;requires&nbsp;another&nbsp;one
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
>>>>> &gt;&nbsp;wrote:
>>>>>> 
>>>>>> &gt;&nbsp;Hi,
>>>>>> &gt;
>>>>>> &gt;
>>>>>> 
>>>>> 
>>>> 
>>> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
>>>>>> 
>>>>> 
>>>> 
>>> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
>>>>>> &gt;&nbsp;this&nbsp;error
>>>>>> &gt;
>>>>>> &gt;
>>>>>> &gt;
>>>>>> &gt;
>>>>>> &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
>>>>>> &gt;&nbsp;java.lang.NoSuchMethodError:
>>>>>> &gt;
>>>>>> 
>>>>> 
>>>> 
>>> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
>>>>>> &gt;
>>>>>> &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
>>>>>> &gt;
>>>>>> &gt;
>>>>>> 
>>>>> 
>>>> 
>>> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
>>>>> 
>>>> 
>> 
>>

Re: calcite multi-threading problem

Posted by Julian Hyde <jh...@gmail.com>.
Should a jira case be logged for this issue? Or is there an existing case? If the latter, should we add a stack trace to help people tie it to this problem?

A jira URL in this thread will help other people who run into this problem in future. Right now it is just a rambling email thread with an off-topic subject.

Julian

> On Feb 25, 2022, at 7:18 AM, Gavin Ray <ra...@gmail.com> wrote:
> 
> Also I just checked and this is updated on master so it should be solved in
> next release FWIW:
> 
> https://github.com/apache/calcite/blob/cbbe5701b7f61d7f8df12d314ba5aabf898c1cae/gradle.properties#L116
> 
>> On Fri, Feb 25, 2022 at 10:16 AM Gavin Ray <ra...@gmail.com> wrote:
>> 
>> The fix for this is just to add janino and commons-compiler as exclusions
>> in the calcite/avatica dependencies
>> And then add the updated version so that it overwrites them
>> 
>> I tested this on your code and it worked
>> 
>> Also, please listen to Stamatis/Julian advice
>> 
>> <dependencies>
>> <dependency>
>> <groupId>org.apache.calcite</groupId>
>> <artifactId>calcite-core</artifactId>
>> <version>1.29.0</version>
>> <exclusions>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> </exclusion>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> </exclusion>
>> </exclusions>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.apache.calcite.avatica</groupId>
>> <artifactId>avatica-core</artifactId>
>> <version>1.20.0</version>
>> <exclusions>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> </exclusion>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> </exclusion>
>> </exclusions>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.apache.calcite</groupId>
>> <artifactId>calcite-file</artifactId>
>> <version>1.29.0</version>
>> <exclusions>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> </exclusion>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> </exclusion>
>> </exclusions>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.apache.calcite</groupId>
>> <artifactId>calcite-example-csv</artifactId>
>> <version>1.21.0</version>
>> <exclusions>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> </exclusion>
>> <exclusion>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> </exclusion>
>> </exclusions>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>janino</artifactId>
>> <version>3.1.6</version>
>> </dependency>
>> 
>> <dependency>
>> <groupId>org.codehaus.janino</groupId>
>> <artifactId>commons-compiler</artifactId>
>> <version>3.1.6</version>
>> </dependency>
>> </dependencies>
>> 
>> 
>> On Fri, Feb 25, 2022 at 9:33 AM xiaobo <gu...@qq.com.invalid>
>> wrote:
>> 
>>> I have put the testing code at github
>>> 
>>> 
>>> https://github.com/guxiaobo/gxb-testing/blob/main/calcite-testing/src/test/java/com/xsmartware/testing/calcite/Test1.java
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Friday, Feb 25, 2022 9:05 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:        calcite multi-threading problem
>>> 
>>> 
>>> 
>>> Hi,
>>> Now we come to the  problem similar as the one at
>>> https://github.com/apache/calcite/pull/2433#issuecomment-860024076,
>>> 
>>> a simple sql "select max(id) from s.t1" caused the following exception,
>>> users report upgrading janino to 3.1.6 can fix this problem, but as we
>>> discussed before janino 3.1.6 is not fully compatible with calcite 1.29.0
>>> because of the dependency issue.
>>> 
>>> 
>>> 
>>>        at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
>>> ~[avatica-core-1.20.0.jar:1.20.0]
>>>        at
>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepare_(CalcitePrepareImpl.java:1032)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepareRel(CalcitePrepareImpl.java:988)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:668)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        ... 13 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
>>> Compiling "Baz" in File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 1,
>>> Column 1: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
>>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>> Column 64
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:369)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52)
>>> ~[commons-compiler-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        at
>>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127)
>>> ~[calcite-core-1.29.0.jar:1.29.0]
>>>        ... 21 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
>>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>> Column 64
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 34 common frames omitted
>>> Caused by: java.lang.RuntimeException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>> Column 64
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2639)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 44 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>>> Column 80: Compiling "new
>>> org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory(new
>>> org.apache.calcite.linq4j.function.Function0() { ... },
>>> accumulatorAdders)": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
>>> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
>>> ... }": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>> Column 21: Compiling "apply()": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>> stack underflow
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 52 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
>>> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
>>> ... }": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>> Column 21: Compiling "apply()": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>> stack underflow
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:8297)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5468)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$9700(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4643)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4604)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$NewClassInstance.accept(Java.java:5560)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 53 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>>> Column 21: Compiling "apply()": File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>> stack underflow
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:977)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:947)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:389)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:386)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1375)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5571)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$9400(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4640)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4604)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5608)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 61 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>>> stack underflow
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2393)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1530)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1523)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:3198)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 78 common frames omitted
>>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
>>> Operand stack underflow
>>>        at org.codehaus.janino.StackMap.peekOperand(StackMap.java:94)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.CodeContext.popOperand(CodeContext.java:1349)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.putfield(UnitCompiler.java:12363)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6498)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$13400(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6480)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6475)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.janino.Java$FieldAccess.accept(Java.java:4668)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6489)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$13200(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6478)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6475)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:4574)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3992)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.access$6000(UnitCompiler.java:231)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3944)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3924)
>>> ~[janino-3.1.4.jar:na]
>>>        at org.codehaus.janino.Java$Assignment.accept(Java.java:4835)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3924)
>>> ~[janino-3.1.4.jar:na]
>>>        at
>>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2391)
>>> ~[janino-3.1.4.jar:na]
>>>        ... 86 common frames omitted
>>> 
>>> With janino 3.1.4
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 9:14 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:       calcite multi-threading problem
>>> 
>>> 
>>> 
>>> 3.1.4 of janino and commons-compiler works now.
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 8:04 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:      calcite multi-threading problem
>>> 
>>> 
>>> 
>>> but strange enough, the same code works in a single thread.
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 8:02 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:     calcite multi-threading problem
>>> 
>>> 
>>> 
>>> we checked the janino release note page
>>> http://janino-compiler.github.io/janino/changelog.html
>>> 
>>> Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties
>>> in java 11: ICompilerFactories were loaded through the current thread's
>>> "context class loader", which is a bad choice in some environments. Thus,
>>> the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and
>>> "getCompilerFactory(className)" were duplicated and augmented with a
>>> "classLoader" parameter.
>>> 
>>> what does this mean?  the getDefaultCompilerFactory method with a
>>> classloader parameter was removed intentionally?
>>> but it seems calcite still needs it , so what version of janino should we
>>> use for the latest calcite-core?
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 12:01 PM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:    calcite multi-threading problem
>>> 
>>> 
>>> 
>>> In our use case, the Java class which opens calcite connection is
>>> contained in a external Java jar file, which is loaded dynamicly through
>>> classloaders other than the default systemloader like this:
>>> 
>>> 
>>> try {
>>>            ClassLoader loader = URLClassLoader.newInstance(
>>>                    new URL[] { new URL("jar:file:" + path + "!/") },
>>>                    getClass().getClassLoader());
>>>            Class<?> clazz = Class.forName(classPath, true, loader);
>>> 
>>> we mention this because the error message shows a classloader parameter.
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 11:56 AM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:   calcite multi-threading problem
>>> 
>>> 
>>> 
>>> And if we remove calcite from our project,  janino is not in "resolved
>>> depencies" library list of pom.xml,
>>> So we think it not the janino conflic problem.
>>> 
>>> 
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiaobo ";<gu...@qq.com>;
>>> Send time: Saturday, Feb 12, 2022 9:49 AM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re:  calcite multi-threading problem
>>> 
>>> 
>>> 
>>> can you share the solution for the problem, we are using the following
>>> libraries, and it seems janino 3.1.6  is only dependent by calcite-core.
>>> 
>>>    <properties>
>>> 
>>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>>>          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
>>>          <java.version>9</java.version>
>>>          <maven.compiler.source>9</maven.compiler.source>
>>>          <maven.compiler.target>9</maven.compiler.target>
>>>        <log4j2.version>2.17.1</log4j2.version>
>>>        <drools.version>7.64.0.Final</drools.version>
>>>   </properties>
>>> 
>>> <groupId>org.apache.calcite</groupId>
>>>            <artifactId>calcite-core</artifactId>
>>>            <version>1.29.0</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.apache.calcite.avatica</groupId>
>>>            <artifactId>avatica-core</artifactId>
>>>            <version>1.20.0</version>
>>>        </dependency>
>>> 
>>> 
>>>    <dependency>
>>>            <groupId>org.drools</groupId>
>>>            <artifactId>drools-core</artifactId>
>>>            <version>${drools.version}</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.drools</groupId>
>>>            <artifactId>drools-compiler</artifactId>
>>>            <version>${drools.version}</version>
>>>        </dependency>
>>>        <dependency>
>>>            <groupId>org.drools</groupId>
>>>            <artifactId>drools-decisiontables</artifactId>
>>>            <version>${drools.version}</version>
>>>        </dependency>
>>> 
>>> 
>>> ------------------ Original ------------------
>>> From:  "xiong duan";<no...@gmail.com>;
>>> Send time: Saturday, Feb 12, 2022 8:43 AM
>>> To: "dev"<de...@calcite.apache.org>;
>>> 
>>> Subject:  Re: calcite multi-threading problem
>>> 
>>> 
>>> 
>>> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
>>> 
>>> Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
>>> 
>>>> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
>>>> version of janino, calcite 1.29 uses the new version of janino and they
>>> are
>>>> not compatible.
>>>> If I downgrade janino version to version which spark uses I got an error
>>>> not method found exception
>>>> If I upgrade the janino version to the version which calcite uses I get
>>> the
>>>> same error but with another method.
>>>> 
>>>> As a result, I built a separate calcite jar package where I shaded
>>> janino
>>>> dependency
>>>> 
>>>> 
>>>> 
>>>> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
>>>> estanilovskiy@gridgain.com> wrote:
>>>> 
>>>>> for example on a current calcite branch:
>>>>> grep janino gradle.properties
>>>>> janino.version=3.1.6
>>>>> 
>>>>> 
>>>>>> yes, we use drools in the same project,&nbsp; and drools uses janino
>>>>>> too, is there a version list of janino which calcite supports?
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---Original---
>>>>>> From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
>>>>>> Date: Fri, Feb 11, 2022 18:30 PM
>>>>>> To: "dev"<dev@calcite.apache.org&gt;;
>>>>>> Subject: Re: calcite multi-threading problem
>>>>>> 
>>>>>> 
>>>>>> Hi!
>>>>>> 
>>>>> 
>>>> 
>>> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
>>>>>> 
>>>>> 
>>>> 
>>> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
>>>>>> calcite&nbsp;requires&nbsp;another&nbsp;one
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
>>>>> &gt;&nbsp;wrote:
>>>>>> 
>>>>>> &gt;&nbsp;Hi,
>>>>>> &gt;
>>>>>> &gt;
>>>>>> 
>>>>> 
>>>> 
>>> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
>>>>>> 
>>>>> 
>>>> 
>>> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
>>>>>> &gt;&nbsp;this&nbsp;error
>>>>>> &gt;
>>>>>> &gt;
>>>>>> &gt;
>>>>>> &gt;
>>>>>> &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
>>>>>> &gt;&nbsp;java.lang.NoSuchMethodError:
>>>>>> &gt;
>>>>>> 
>>>>> 
>>>> 
>>> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
>>>>>> &gt;
>>>>>> &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
>>>>>> &gt;
>>>>>> &gt;
>>>>>> 
>>>>> 
>>>> 
>>> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
>>>>> 
>>>> 
>> 
>> 

Re: calcite multi-threading problem

Posted by Gavin Ray <ra...@gmail.com>.
Also I just checked and this is updated on master so it should be solved in
next release FWIW:

https://github.com/apache/calcite/blob/cbbe5701b7f61d7f8df12d314ba5aabf898c1cae/gradle.properties#L116

On Fri, Feb 25, 2022 at 10:16 AM Gavin Ray <ra...@gmail.com> wrote:

> The fix for this is just to add janino and commons-compiler as exclusions
> in the calcite/avatica dependencies
> And then add the updated version so that it overwrites them
>
> I tested this on your code and it worked
>
> Also, please listen to Stamatis/Julian advice
>
> <dependencies>
> <dependency>
> <groupId>org.apache.calcite</groupId>
> <artifactId>calcite-core</artifactId>
> <version>1.29.0</version>
> <exclusions>
> <exclusion>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>janino</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>commons-compiler</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
> <dependency>
> <groupId>org.apache.calcite.avatica</groupId>
> <artifactId>avatica-core</artifactId>
> <version>1.20.0</version>
> <exclusions>
> <exclusion>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>janino</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>commons-compiler</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
> <dependency>
> <groupId>org.apache.calcite</groupId>
> <artifactId>calcite-file</artifactId>
> <version>1.29.0</version>
> <exclusions>
> <exclusion>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>janino</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>commons-compiler</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
> <dependency>
> <groupId>org.apache.calcite</groupId>
> <artifactId>calcite-example-csv</artifactId>
> <version>1.21.0</version>
> <exclusions>
> <exclusion>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>janino</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>commons-compiler</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
> <dependency>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>janino</artifactId>
> <version>3.1.6</version>
> </dependency>
>
> <dependency>
> <groupId>org.codehaus.janino</groupId>
> <artifactId>commons-compiler</artifactId>
> <version>3.1.6</version>
> </dependency>
> </dependencies>
>
>
> On Fri, Feb 25, 2022 at 9:33 AM xiaobo <gu...@qq.com.invalid>
> wrote:
>
>> I have put the testing code at github
>>
>>
>> https://github.com/guxiaobo/gxb-testing/blob/main/calcite-testing/src/test/java/com/xsmartware/testing/calcite/Test1.java
>>
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "xiaobo ";<gu...@qq.com>;
>> Send time: Friday, Feb 25, 2022 9:05 PM
>> To: "dev"<de...@calcite.apache.org>;
>>
>> Subject:  Re:        calcite multi-threading problem
>>
>>
>>
>> Hi,
>> Now we come to the  problem similar as the one at
>> https://github.com/apache/calcite/pull/2433#issuecomment-860024076,
>>
>> a simple sql "select max(id) from s.t1" caused the following exception,
>> users report upgrading janino to 3.1.6 can fix this problem, but as we
>> discussed before janino 3.1.6 is not fully compatible with calcite 1.29.0
>> because of the dependency issue.
>>
>>
>>
>>         at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
>> ~[avatica-core-1.20.0.jar:1.20.0]
>>         at
>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepare_(CalcitePrepareImpl.java:1032)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepareRel(CalcitePrepareImpl.java:988)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:668)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         ... 13 common frames omitted
>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
>> Compiling "Baz" in File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 1,
>> Column 1: File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>> Column 64
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:369)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330)
>> ~[janino-3.1.4.jar:na]
>>         at org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267)
>> ~[janino-3.1.4.jar:na]
>>         at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52)
>> ~[commons-compiler-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         at
>> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127)
>> ~[calcite-core-1.29.0.jar:1.29.0]
>>         ... 21 common frames omitted
>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
>> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>> Column 64
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359)
>> ~[janino-3.1.4.jar:na]
>>         ... 34 common frames omitted
>> Caused by: java.lang.RuntimeException: File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>> Column 64
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2639)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
>> ~[janino-3.1.4.jar:na]
>>         ... 44 common frames omitted
>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
>> Column 80: Compiling "new
>> org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory(new
>> org.apache.calcite.linq4j.function.Function0() { ... },
>> accumulatorAdders)": File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
>> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
>> ... }": File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>> Column 21: Compiling "apply()": File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>> stack underflow
>>         at
>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622)
>> ~[janino-3.1.4.jar:na]
>>         ... 52 common frames omitted
>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
>> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
>> ... }": File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>> Column 21: Compiling "apply()": File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>> stack underflow
>>         at
>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:8297)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5468)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$9700(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4643)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4604)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.Java$NewClassInstance.accept(Java.java:5560)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
>> ~[janino-3.1.4.jar:na]
>>         ... 53 common frames omitted
>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
>> Column 21: Compiling "apply()": File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>> stack underflow
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:977)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:947)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:389)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:386)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1375)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5571)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$9400(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4640)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4604)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5608)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
>> ~[janino-3.1.4.jar:na]
>>         ... 61 common frames omitted
>> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
>> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
>> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
>> stack underflow
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2393)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1530)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1523)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:3198)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
>> ~[janino-3.1.4.jar:na]
>>         ... 78 common frames omitted
>> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
>> Operand stack underflow
>>         at org.codehaus.janino.StackMap.peekOperand(StackMap.java:94)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.CodeContext.popOperand(CodeContext.java:1349)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.putfield(UnitCompiler.java:12363)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6498)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$13400(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6480)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6475)
>> ~[janino-3.1.4.jar:na]
>>         at org.codehaus.janino.Java$FieldAccess.accept(Java.java:4668)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6489)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$13200(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6478)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6475)
>> ~[janino-3.1.4.jar:na]
>>         at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:4574)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3992)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.access$6000(UnitCompiler.java:231)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3944)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3924)
>> ~[janino-3.1.4.jar:na]
>>         at org.codehaus.janino.Java$Assignment.accept(Java.java:4835)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3924)
>> ~[janino-3.1.4.jar:na]
>>         at
>> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2391)
>> ~[janino-3.1.4.jar:na]
>>         ... 86 common frames omitted
>>
>> With janino 3.1.4
>>
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "xiaobo ";<gu...@qq.com>;
>> Send time: Saturday, Feb 12, 2022 9:14 PM
>> To: "dev"<de...@calcite.apache.org>;
>>
>> Subject:  Re:       calcite multi-threading problem
>>
>>
>>
>> 3.1.4 of janino and commons-compiler works now.
>>
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "xiaobo ";<gu...@qq.com>;
>> Send time: Saturday, Feb 12, 2022 8:04 PM
>> To: "dev"<de...@calcite.apache.org>;
>>
>> Subject:  Re:      calcite multi-threading problem
>>
>>
>>
>> but strange enough, the same code works in a single thread.
>>
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "xiaobo ";<gu...@qq.com>;
>> Send time: Saturday, Feb 12, 2022 8:02 PM
>> To: "dev"<de...@calcite.apache.org>;
>>
>> Subject:  Re:     calcite multi-threading problem
>>
>>
>>
>> we checked the janino release note page
>> http://janino-compiler.github.io/janino/changelog.html
>>
>> Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties
>> in java 11: ICompilerFactories were loaded through the current thread's
>> "context class loader", which is a bad choice in some environments. Thus,
>> the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and
>> "getCompilerFactory(className)" were duplicated and augmented with a
>> "classLoader" parameter.
>>
>> what does this mean?  the getDefaultCompilerFactory method with a
>> classloader parameter was removed intentionally?
>> but it seems calcite still needs it , so what version of janino should we
>> use for the latest calcite-core?
>>
>>
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "xiaobo ";<gu...@qq.com>;
>> Send time: Saturday, Feb 12, 2022 12:01 PM
>> To: "dev"<de...@calcite.apache.org>;
>>
>> Subject:  Re:    calcite multi-threading problem
>>
>>
>>
>> In our use case, the Java class which opens calcite connection is
>> contained in a external Java jar file, which is loaded dynamicly through
>> classloaders other than the default systemloader like this:
>>
>>
>> try {
>>             ClassLoader loader = URLClassLoader.newInstance(
>>                     new URL[] { new URL("jar:file:" + path + "!/") },
>>                     getClass().getClassLoader());
>>             Class<?> clazz = Class.forName(classPath, true, loader);
>>
>> we mention this because the error message shows a classloader parameter.
>>
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "xiaobo ";<gu...@qq.com>;
>> Send time: Saturday, Feb 12, 2022 11:56 AM
>> To: "dev"<de...@calcite.apache.org>;
>>
>> Subject:  Re:   calcite multi-threading problem
>>
>>
>>
>> And if we remove calcite from our project,  janino is not in "resolved
>> depencies" library list of pom.xml,
>> So we think it not the janino conflic problem.
>>
>>
>>
>>
>> ------------------ Original ------------------
>> From:  "xiaobo ";<gu...@qq.com>;
>> Send time: Saturday, Feb 12, 2022 9:49 AM
>> To: "dev"<de...@calcite.apache.org>;
>>
>> Subject:  Re:  calcite multi-threading problem
>>
>>
>>
>> can you share the solution for the problem, we are using the following
>> libraries, and it seems janino 3.1.6  is only dependent by calcite-core.
>>
>>     <properties>
>>
>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>>           <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
>>           <java.version>9</java.version>
>>           <maven.compiler.source>9</maven.compiler.source>
>>           <maven.compiler.target>9</maven.compiler.target>
>>         <log4j2.version>2.17.1</log4j2.version>
>>         <drools.version>7.64.0.Final</drools.version>
>>    </properties>
>>
>> <groupId>org.apache.calcite</groupId>
>>             <artifactId>calcite-core</artifactId>
>>             <version>1.29.0</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.calcite.avatica</groupId>
>>             <artifactId>avatica-core</artifactId>
>>             <version>1.20.0</version>
>>         </dependency>
>>
>>
>>     <dependency>
>>             <groupId>org.drools</groupId>
>>             <artifactId>drools-core</artifactId>
>>             <version>${drools.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.drools</groupId>
>>             <artifactId>drools-compiler</artifactId>
>>             <version>${drools.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.drools</groupId>
>>             <artifactId>drools-decisiontables</artifactId>
>>             <version>${drools.version}</version>
>>         </dependency>
>>
>>
>> ------------------ Original ------------------
>> From:  "xiong duan";<no...@gmail.com>;
>> Send time: Saturday, Feb 12, 2022 8:43 AM
>> To: "dev"<de...@calcite.apache.org>;
>>
>> Subject:  Re: calcite multi-threading problem
>>
>>
>>
>> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
>>
>> Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
>>
>> > Actually, I had the same problem with spark. Spark 3.2.1 uses the old
>> > version of janino, calcite 1.29 uses the new version of janino and they
>> are
>> > not compatible.
>> > If I downgrade janino version to version which spark uses I got an error
>> > not method found exception
>> > If I upgrade the janino version to the version which calcite uses I get
>> the
>> > same error but with another method.
>> >
>> > As a result, I built a separate calcite jar package where I shaded
>> janino
>> > dependency
>> >
>> >
>> >
>> > On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
>> > estanilovskiy@gridgain.com> wrote:
>> >
>> > > for example on a current calcite branch:
>> > > grep janino gradle.properties
>> > > janino.version=3.1.6
>> > >
>> > >
>> > > > yes, we use drools in the same project,&nbsp; and drools uses janino
>> > > > too, is there a version list of janino which calcite supports?
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > ---Original---
>> > > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
>> > > > Date: Fri, Feb 11, 2022 18:30 PM
>> > > > To: "dev"<dev@calcite.apache.org&gt;;
>> > > > Subject: Re: calcite multi-threading problem
>> > > >
>> > > >
>> > > > Hi!
>> > > >
>> > >
>> >
>> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
>> > > >
>> > >
>> >
>> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
>> > > > calcite&nbsp;requires&nbsp;another&nbsp;one
>> > > >
>> > > >
>> > >
>> >
>> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
>> > > &gt;&nbsp;wrote:
>> > > >
>> > > > &gt;&nbsp;Hi,
>> > > > &gt;
>> > > > &gt;
>> > > >
>> > >
>> >
>> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
>> > > >
>> > >
>> >
>> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
>> > > > &gt;&nbsp;this&nbsp;error
>> > > > &gt;
>> > > > &gt;
>> > > > &gt;
>> > > > &gt;
>> > > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
>> > > > &gt;&nbsp;java.lang.NoSuchMethodError:
>> > > > &gt;
>> > > >
>> > >
>> >
>> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
>> > > > &gt;
>> > > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
>> > > > &gt;
>> > > > &gt;
>> > > >
>> > >
>> >
>> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
>> > >
>> >
>
>

Re: calcite multi-threading problem

Posted by Gavin Ray <ra...@gmail.com>.
The fix for this is just to add janino and commons-compiler as exclusions
in the calcite/avatica dependencies
And then add the updated version so that it overwrites them

I tested this on your code and it worked

Also, please listen to Stamatis/Julian advice

<dependencies>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
<version>1.29.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.calcite.avatica</groupId>
<artifactId>avatica-core</artifactId>
<version>1.20.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-file</artifactId>
<version>1.29.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-example-csv</artifactId>
<version>1.21.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.1.6</version>
</dependency>

<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
<version>3.1.6</version>
</dependency>
</dependencies>


On Fri, Feb 25, 2022 at 9:33 AM xiaobo <gu...@qq.com.invalid> wrote:

> I have put the testing code at github
>
>
> https://github.com/guxiaobo/gxb-testing/blob/main/calcite-testing/src/test/java/com/xsmartware/testing/calcite/Test1.java
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Friday, Feb 25, 2022 9:05 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:        calcite multi-threading problem
>
>
>
> Hi,
> Now we come to the  problem similar as the one at
> https://github.com/apache/calcite/pull/2433#issuecomment-860024076,
>
> a simple sql "select max(id) from s.t1" caused the following exception,
> users report upgrading janino to 3.1.6 can fix this problem, but as we
> discussed before janino 3.1.6 is not fully compatible with calcite 1.29.0
> because of the dependency issue.
>
>
>
>         at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
> ~[avatica-core-1.20.0.jar:1.20.0]
>         at
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepare_(CalcitePrepareImpl.java:1032)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepareRel(CalcitePrepareImpl.java:988)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:668)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         ... 13 common frames omitted
> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> Compiling "Baz" in File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 1,
> Column 1: File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
> Column 64
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:369)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330)
> ~[janino-3.1.4.jar:na]
>         at org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267)
> ~[janino-3.1.4.jar:na]
>         at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52)
> ~[commons-compiler-3.1.4.jar:na]
>         at
> org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428)
> ~[janino-3.1.4.jar:na]
>         at
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         at
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127)
> ~[calcite-core-1.29.0.jar:1.29.0]
>         ... 21 common frames omitted
> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41,
> Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
> Column 64
>         at
> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692)
> ~[janino-3.1.4.jar:na]
>         at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359)
> ~[janino-3.1.4.jar:na]
>         ... 34 common frames omitted
> Caused by: java.lang.RuntimeException: File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
> Column 64
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2639)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
> ~[janino-3.1.4.jar:na]
>         ... 44 common frames omitted
> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60,
> Column 80: Compiling "new
> org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory(new
> org.apache.calcite.linq4j.function.Function0() { ... },
> accumulatorAdders)": File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
> ... }": File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
> Column 21: Compiling "apply()": File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
> stack underflow
>         at
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622)
> ~[janino-3.1.4.jar:na]
>         ... 52 common frames omitted
> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61,
> Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() {
> ... }": File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
> Column 21: Compiling "apply()": File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
> stack underflow
>         at
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:8297)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5468)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$9700(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4643)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4604)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.Java$NewClassInstance.accept(Java.java:5560)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
> ~[janino-3.1.4.jar:na]
>         ... 53 common frames omitted
> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62,
> Column 21: Compiling "apply()": File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
> stack underflow
>         at
> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:977)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:947)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:389)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:386)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1375)
> ~[janino-3.1.4.jar:na]
>         at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5571)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$9400(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4640)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4604)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5608)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729)
> ~[janino-3.1.4.jar:na]
>         ... 61 common frames omitted
> Caused by: org.codehaus.commons.compiler.InternalCompilerException: File
> '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70,
> Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand
> stack underflow
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2393)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1530)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1523)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:3198)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218)
> ~[janino-3.1.4.jar:na]
>         ... 78 common frames omitted
> Caused by: org.codehaus.commons.compiler.InternalCompilerException:
> Operand stack underflow
>         at org.codehaus.janino.StackMap.peekOperand(StackMap.java:94)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.CodeContext.popOperand(CodeContext.java:1349)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.putfield(UnitCompiler.java:12363)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6498)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$13400(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6480)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6475)
> ~[janino-3.1.4.jar:na]
>         at org.codehaus.janino.Java$FieldAccess.accept(Java.java:4668)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6489)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$13200(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6478)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6475)
> ~[janino-3.1.4.jar:na]
>         at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:4574)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3992)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.access$6000(UnitCompiler.java:231)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3944)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3924)
> ~[janino-3.1.4.jar:na]
>         at org.codehaus.janino.Java$Assignment.accept(Java.java:4835)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3924)
> ~[janino-3.1.4.jar:na]
>         at
> org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2391)
> ~[janino-3.1.4.jar:na]
>         ... 86 common frames omitted
>
> With janino 3.1.4
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 9:14 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:       calcite multi-threading problem
>
>
>
> 3.1.4 of janino and commons-compiler works now.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 8:04 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:      calcite multi-threading problem
>
>
>
> but strange enough, the same code works in a single thread.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 8:02 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:     calcite multi-threading problem
>
>
>
> we checked the janino release note page
> http://janino-compiler.github.io/janino/changelog.html
>
> Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties
> in java 11: ICompilerFactories were loaded through the current thread's
> "context class loader", which is a bad choice in some environments. Thus,
> the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and
> "getCompilerFactory(className)" were duplicated and augmented with a
> "classLoader" parameter.
>
> what does this mean?  the getDefaultCompilerFactory method with a
> classloader parameter was removed intentionally?
> but it seems calcite still needs it , so what version of janino should we
> use for the latest calcite-core?
>
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 12:01 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:    calcite multi-threading problem
>
>
>
> In our use case, the Java class which opens calcite connection is
> contained in a external Java jar file, which is loaded dynamicly through
> classloaders other than the default systemloader like this:
>
>
> try {
>             ClassLoader loader = URLClassLoader.newInstance(
>                     new URL[] { new URL("jar:file:" + path + "!/") },
>                     getClass().getClassLoader());
>             Class<?> clazz = Class.forName(classPath, true, loader);
>
> we mention this because the error message shows a classloader parameter.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 11:56 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:   calcite multi-threading problem
>
>
>
> And if we remove calcite from our project,  janino is not in "resolved
> depencies" library list of pom.xml,
> So we think it not the janino conflic problem.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 9:49 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:  calcite multi-threading problem
>
>
>
> can you share the solution for the problem, we are using the following
> libraries, and it seems janino 3.1.6  is only dependent by calcite-core.
>
>     <properties>
>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>           <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
>           <java.version>9</java.version>
>           <maven.compiler.source>9</maven.compiler.source>
>           <maven.compiler.target>9</maven.compiler.target>
>         <log4j2.version>2.17.1</log4j2.version>
>         <drools.version>7.64.0.Final</drools.version>
>    </properties>
>
> <groupId>org.apache.calcite</groupId>
>             <artifactId>calcite-core</artifactId>
>             <version>1.29.0</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.calcite.avatica</groupId>
>             <artifactId>avatica-core</artifactId>
>             <version>1.20.0</version>
>         </dependency>
>
>
>     <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-core</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-compiler</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-decisiontables</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>
>
> ------------------ Original ------------------
> From:  "xiong duan";<no...@gmail.com>;
> Send time: Saturday, Feb 12, 2022 8:43 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re: calcite multi-threading problem
>
>
>
> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
>
> Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
>
> > Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> > version of janino, calcite 1.29 uses the new version of janino and they
> are
> > not compatible.
> > If I downgrade janino version to version which spark uses I got an error
> > not method found exception
> > If I upgrade the janino version to the version which calcite uses I get
> the
> > same error but with another method.
> >
> > As a result, I built a separate calcite jar package where I shaded janino
> > dependency
> >
> >
> >
> > On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> > estanilovskiy@gridgain.com> wrote:
> >
> > > for example on a current calcite branch:
> > > grep janino gradle.properties
> > > janino.version=3.1.6
> > >
> > >
> > > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > > too, is there a version list of janino which calcite supports?
> > > >
> > > >
> > > >
> > > >
> > > > ---Original---
> > > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > > Date: Fri, Feb 11, 2022 18:30 PM
> > > > To: "dev"<dev@calcite.apache.org&gt;;
> > > > Subject: Re: calcite multi-threading problem
> > > >
> > > >
> > > > Hi!
> > > >
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > > >
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > > >
> > > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > > &gt;&nbsp;wrote:
> > > >
> > > > &gt;&nbsp;Hi,
> > > > &gt;
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > > >
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > > &gt;&nbsp;this&nbsp;error
> > > > &gt;
> > > > &gt;
> > > > &gt;
> > > > &gt;
> > > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > > &gt;
> > > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > > &gt;
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> > >
> >

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
I have put the testing code at github

https://github.com/guxiaobo/gxb-testing/blob/main/calcite-testing/src/test/java/com/xsmartware/testing/calcite/Test1.java




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Friday, Feb 25, 2022 9:05 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:        calcite multi-threading problem



Hi,
Now we come to the  problem similar as the one at https://github.com/apache/calcite/pull/2433#issuecomment-860024076,

a simple sql "select max(id) from s.t1" caused the following exception,  users report upgrading janino to 3.1.6 can fix this problem, but as we discussed before janino 3.1.6 is not fully compatible with calcite 1.29.0 because of the dependency issue.



	at org.apache.calcite.avatica.Helper.wrap(Helper.java:37) ~[avatica-core-1.20.0.jar:1.20.0]
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepare_(CalcitePrepareImpl.java:1032) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepareRel(CalcitePrepareImpl.java:988) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:668) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229) ~[calcite-core-1.29.0.jar:1.29.0]
	... 13 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: Compiling "Baz" in File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 1, Column 1: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41, Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60, Column 64
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:369) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267) ~[janino-3.1.4.jar:na]
	at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52) ~[commons-compiler-3.1.4.jar:na]
	at org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428) ~[janino-3.1.4.jar:na]
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127) ~[calcite-core-1.29.0.jar:1.29.0]
	... 21 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41, Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60, Column 64
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359) ~[janino-3.1.4.jar:na]
	... 34 common frames omitted
Caused by: java.lang.RuntimeException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60, Column 64
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2639) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218) ~[janino-3.1.4.jar:na]
	... 44 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60, Column 80: Compiling "new org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory(new org.apache.calcite.linq4j.function.Function0() { ... }, accumulatorAdders)": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61, Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() { ... }": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62, Column 21: Compiling "apply()": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70, Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622) ~[janino-3.1.4.jar:na]
	... 52 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61, Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() { ... }": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62, Column 21: Compiling "apply()": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70, Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:8297) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5468) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$9700(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4643) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4604) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:5560) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729) ~[janino-3.1.4.jar:na]
	... 53 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62, Column 21: Compiling "apply()": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70, Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:977) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:947) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:389) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:386) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1375) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5571) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$9400(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4640) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4604) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5608) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729) ~[janino-3.1.4.jar:na]
	... 61 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70, Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2393) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1530) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1523) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:3198) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218) ~[janino-3.1.4.jar:na]
	... 78 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.StackMap.peekOperand(StackMap.java:94) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.CodeContext.popOperand(CodeContext.java:1349) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.putfield(UnitCompiler.java:12363) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6498) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$13400(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6480) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6475) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$FieldAccess.accept(Java.java:4668) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6489) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$13200(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6478) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6475) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:4574) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3992) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$6000(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3944) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3924) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$Assignment.accept(Java.java:4835) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3924) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2391) ~[janino-3.1.4.jar:na]
	... 86 common frames omitted

With janino 3.1.4




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:14 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:       calcite multi-threading problem



3.1.4 of janino and commons-compiler works now.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 8:04 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:      calcite multi-threading problem



but strange enough, the same code works in a single thread.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 8:02 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:     calcite multi-threading problem



we checked the janino release note page
http://janino-compiler.github.io/janino/changelog.html

Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some environments. Thus, the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and "getCompilerFactory(className)" were duplicated and augmented with a "classLoader" parameter. 

what does this mean?  the getDefaultCompilerFactory method with a classloader parameter was removed intentionally?
but it seems calcite still needs it , so what version of janino should we use for the latest calcite-core?





------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 12:01 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:    calcite multi-threading problem



In our use case, the Java class which opens calcite connection is contained in a external Java jar file, which is loaded dynamicly through classloaders other than the default systemloader like this:


try {
            ClassLoader loader = URLClassLoader.newInstance(
                    new URL[] { new URL("jar:file:" + path + "!/") },
                    getClass().getClassLoader());
            Class<?> clazz = Class.forName(classPath, true, loader);

we mention this because the error message shows a classloader parameter.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 11:56 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:   calcite multi-threading problem



And if we remove calcite from our project,  janino is not in "resolved depencies" library list of pom.xml,
So we think it not the janino conflic problem.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:49 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:  calcite multi-threading problem



can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6  is only dependent by calcite-core.

    <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <java.version>9</java.version>
          <maven.compiler.source>9</maven.compiler.source>
          <maven.compiler.target>9</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>
        <drools.version>7.64.0.Final</drools.version>
   </properties>

<groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.29.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica-core</artifactId>
            <version>1.20.0</version>
        </dependency>


    <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>


------------------ Original ------------------
From:  "xiong duan";<no...@gmail.com>;
Send time: Saturday, Feb 12, 2022 8:43 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
Hi,
Now we come to the  problem similar as the one at https://github.com/apache/calcite/pull/2433#issuecomment-860024076,

a simple sql "select max(id) from s.t1" caused the following exception,  users report upgrading janino to 3.1.6 can fix this problem, but as we discussed before janino 3.1.6 is not fully compatible with calcite 1.29.0 because of the dependency issue.



	at org.apache.calcite.avatica.Helper.wrap(Helper.java:37) ~[avatica-core-1.20.0.jar:1.20.0]
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:130) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepare_(CalcitePrepareImpl.java:1032) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.prepareRel(CalcitePrepareImpl.java:988) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:668) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229) ~[calcite-core-1.29.0.jar:1.29.0]
	... 13 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: Compiling "Baz" in File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 1, Column 1: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41, Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60, Column 64
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:369) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$000(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:333) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$1.visitCompilationUnit(UnitCompiler.java:330) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$CompilationUnit.accept(Java.java:367) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:330) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:245) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:294) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:288) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.ClassBodyEvaluator.cook(ClassBodyEvaluator.java:267) ~[janino-3.1.4.jar:na]
	at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:52) ~[commons-compiler-3.1.4.jar:na]
	at org.codehaus.janino.ClassBodyEvaluator.createInstance(ClassBodyEvaluator.java:428) ~[janino-3.1.4.jar:na]
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.getBindable(EnumerableInterpretable.java:166) ~[calcite-core-1.29.0.jar:1.29.0]
	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:127) ~[calcite-core-1.29.0.jar:1.29.0]
	... 21 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 41, Column 45: Compiling "bind(org.apache.calcite.DataContext root)": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60, Column 64
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:412) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:391) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:386) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1692) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:359) ~[janino-3.1.4.jar:na]
	... 34 common frames omitted
Caused by: java.lang.RuntimeException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60, Column 64
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2639) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1539) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1523) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:3840) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218) ~[janino-3.1.4.jar:na]
	... 44 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 60, Column 80: Compiling "new org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory(new org.apache.calcite.linq4j.function.Function0() { ... }, accumulatorAdders)": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61, Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() { ... }": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62, Column 21: Compiling "apply()": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70, Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2622) ~[janino-3.1.4.jar:na]
	... 52 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 61, Column 5: Compiling "new org.apache.calcite.linq4j.function.Function0() { ... }": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62, Column 21: Compiling "apply()": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70, Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5731) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:8297) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5468) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$9700(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4643) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$15.visitNewClassInstance(UnitCompiler.java:4604) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:5560) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729) ~[janino-3.1.4.jar:na]
	... 53 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 62, Column 21: Compiling "apply()": File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70, Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3222) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1379) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1352) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:800) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:977) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:947) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$200(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:389) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$2.visitAnonymousClassDeclaration(UnitCompiler.java:386) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$AnonymousClassDeclaration.accept(Java.java:1375) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:386) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5571) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$9400(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4640) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$15.visitNewAnonymousClassInstance(UnitCompiler.java:4604) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$NewAnonymousClassInstance.accept(Java.java:5608) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4604) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5729) ~[janino-3.1.4.jar:na]
	... 61 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: File '/Users/linda/Downloads/janino/janino6606844895950068558.java', Line 70, Column 17: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2393) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1530) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1523) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:3198) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1523) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1607) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3531) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3218) ~[janino-3.1.4.jar:na]
	... 78 common frames omitted
Caused by: org.codehaus.commons.compiler.InternalCompilerException: Operand stack underflow
	at org.codehaus.janino.StackMap.peekOperand(StackMap.java:94) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.CodeContext.popOperand(CodeContext.java:1349) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.putfield(UnitCompiler.java:12363) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6498) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$13400(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6480) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$20.visitFieldAccess(UnitCompiler.java:6475) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$FieldAccess.accept(Java.java:4668) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileSet2(UnitCompiler.java:6489) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$13200(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6478) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$20.visitAmbiguousName(UnitCompiler.java:6475) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:4574) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compileSet(UnitCompiler.java:6475) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3992) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.access$6000(UnitCompiler.java:231) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3944) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler$12.visitAssignment(UnitCompiler.java:3924) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.Java$Assignment.accept(Java.java:4835) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3924) ~[janino-3.1.4.jar:na]
	at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2391) ~[janino-3.1.4.jar:na]
	... 86 common frames omitted

With janino 3.1.4




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:14 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:       calcite multi-threading problem



3.1.4 of janino and commons-compiler works now.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 8:04 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:      calcite multi-threading problem



but strange enough, the same code works in a single thread.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 8:02 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:     calcite multi-threading problem



we checked the janino release note page
http://janino-compiler.github.io/janino/changelog.html

Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some environments. Thus, the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and "getCompilerFactory(className)" were duplicated and augmented with a "classLoader" parameter. 

what does this mean?  the getDefaultCompilerFactory method with a classloader parameter was removed intentionally?
but it seems calcite still needs it , so what version of janino should we use for the latest calcite-core?





------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 12:01 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:    calcite multi-threading problem



In our use case, the Java class which opens calcite connection is contained in a external Java jar file, which is loaded dynamicly through classloaders other than the default systemloader like this:


try {
            ClassLoader loader = URLClassLoader.newInstance(
                    new URL[] { new URL("jar:file:" + path + "!/") },
                    getClass().getClassLoader());
            Class<?> clazz = Class.forName(classPath, true, loader);

we mention this because the error message shows a classloader parameter.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 11:56 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:   calcite multi-threading problem



And if we remove calcite from our project,  janino is not in "resolved depencies" library list of pom.xml,
So we think it not the janino conflic problem.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:49 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:  calcite multi-threading problem



can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6  is only dependent by calcite-core.

    <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <java.version>9</java.version>
          <maven.compiler.source>9</maven.compiler.source>
          <maven.compiler.target>9</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>
        <drools.version>7.64.0.Final</drools.version>
   </properties>

<groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.29.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica-core</artifactId>
            <version>1.20.0</version>
        </dependency>


    <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>


------------------ Original ------------------
From:  "xiong duan";<no...@gmail.com>;
Send time: Saturday, Feb 12, 2022 8:43 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

Re: calcite multi-threading problem

Posted by Stamatis Zampetakis <za...@gmail.com>.
Hi,

If each connection has its own schema object I suppose it will work but
it is not something that is tested or documented.

Best,
Stamatis

On Wed, Feb 16, 2022 at 1:49 AM xiaobo <gu...@qq.com.invalid> wrote:

> Hi Stamatis,
>
> Finally we are talking about the threading side about the problem,
>
> can we open multiple connections from mutiple threads against the same
> ReflectiveSchema schema with the same target object ?
>
>
>
>
>
>
> ------------------ Original ------------------
> From:  "Stamatis Zampetakis";<za...@gmail.com>;
> Send time: Monday, Feb 14, 2022 5:49 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re: calcite multi-threading problem
>
>
>
> Hi,
>
> I haven't gone through all the exchanges but wanted to mention that in
> general the JDBC connection APIs are not thread-safe.
>
> You previously mentioned the following:
> "we open a calcite connection with ReflectiveSchema in one thread, and
> execute sqls in other  threads against the connection, but failed with
> this error"
>
> This is not a supported use case. Every thread should have its own
> connection and you shouldn't use the same connection instance from multiple
> threads.
>
> Best,
> Stamatis
>
> On Sat, Feb 12, 2022 at 2:14 PM xiaobo <gu...@qq.com.invalid>
> wrote:
>
> > 3.1.4 of janino and commons-compiler works now.
> >
> >
> >
> >
> > ------------------ Original ------------------
> > From:  "xiaobo ";<gu...@qq.com>;
> > Send time: Saturday, Feb 12, 2022 8:04 PM
> > To: "dev"<de...@calcite.apache.org>;
> >
> > Subject:  Re:      calcite multi-threading problem
> >
> >
> >
> > but strange enough, the same code works in a single thread.
> >
> >
> >
> >
> > ------------------ Original ------------------
> > From:  "xiaobo ";<gu...@qq.com>;
> > Send time: Saturday, Feb 12, 2022 8:02 PM
> > To: "dev"<de...@calcite.apache.org>;
> >
> > Subject:  Re:     calcite multi-threading problem
> >
> >
> >
> > we checked the janino release note page
> > http://janino-compiler.github.io/janino/changelog.html
> >
> > Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties
> > in java 11: ICompilerFactories were loaded through the current thread's
> > "context class loader", which is a bad choice in some environments. Thus,
> > the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()"
> and
> > "getCompilerFactory(className)" were duplicated and augmented with a
> > "classLoader" parameter.
> >
> > what does this mean?  the getDefaultCompilerFactory method with a
> > classloader parameter was removed intentionally?
> > but it seems calcite still needs it , so what version of janino should we
> > use for the latest calcite-core?
> >
> >
> >
> >
> >
> > ------------------ Original ------------------
> > From:  "xiaobo ";<gu...@qq.com>;
> > Send time: Saturday, Feb 12, 2022 12:01 PM
> > To: "dev"<de...@calcite.apache.org>;
> >
> > Subject:  Re:    calcite multi-threading problem
> >
> >
> >
> > In our use case, the Java class which opens calcite connection is
> > contained in a external Java jar file, which is loaded dynamicly through
> > classloaders other than the default systemloader like this:
> >
> >
> > try {
> >             ClassLoader loader = URLClassLoader.newInstance(
> >                     new URL[] { new URL("jar:file:" + path + "!/") },
> >                     getClass().getClassLoader());
> >             Class<?> clazz = Class.forName(classPath, true, loader);
> >
> > we mention this because the error message shows a classloader parameter.
> >
> >
> >
> >
> > ------------------ Original ------------------
> > From:  "xiaobo ";<gu...@qq.com>;
> > Send time: Saturday, Feb 12, 2022 11:56 AM
> > To: "dev"<de...@calcite.apache.org>;
> >
> > Subject:  Re:   calcite multi-threading problem
> >
> >
> >
> > And if we remove calcite from our project,  janino is not in "resolved
> > depencies" library list of pom.xml,
> > So we think it not the janino conflic problem.
> >
> >
> >
> >
> > ------------------ Original ------------------
> > From:  "xiaobo ";<gu...@qq.com>;
> > Send time: Saturday, Feb 12, 2022 9:49 AM
> > To: "dev"<de...@calcite.apache.org>;
> >
> > Subject:  Re:  calcite multi-threading problem
> >
> >
> >
> > can you share the solution for the problem, we are using the following
> > libraries, and it seems janino 3.1.6  is only dependent by calcite-core.
> >
> >     <properties>
> >
> > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> >           <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
> >           <java.version>9</java.version>
> >           <maven.compiler.source>9</maven.compiler.source>
> >           <maven.compiler.target>9</maven.compiler.target>
> >         <log4j2.version>2.17.1</log4j2.version>
> >         <drools.version>7.64.0.Final</drools.version>
> >    </properties>
> >
> > <groupId>org.apache.calcite</groupId>
> >             <artifactId>calcite-core</artifactId>
> >             <version>1.29.0</version>
> >         </dependency>
> >         <dependency>
> >             <groupId>org.apache.calcite.avatica</groupId>
> >             <artifactId>avatica-core</artifactId>
> >             <version>1.20.0</version>
> >         </dependency>
> >
> >
> >     <dependency>
> >             <groupId>org.drools</groupId>
> >             <artifactId>drools-core</artifactId>
> >             <version>${drools.version}</version>
> >         </dependency>
> >         <dependency>
> >             <groupId>org.drools</groupId>
> >             <artifactId>drools-compiler</artifactId>
> >             <version>${drools.version}</version>
> >         </dependency>
> >         <dependency>
> >             <groupId>org.drools</groupId>
> >             <artifactId>drools-decisiontables</artifactId>
> >             <version>${drools.version}</version>
> >         </dependency>
> >
> >
> > ------------------ Original ------------------
> > From:  "xiong duan";<no...@gmail.com>;
> > Send time: Saturday, Feb 12, 2022 8:43 AM
> > To: "dev"<de...@calcite.apache.org>;
> >
> > Subject:  Re: calcite multi-threading problem
> >
> >
> >
> > Yes, It is a dependency issue. I have met the same problem. +1 for
> Dmitry.
> >
> > Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
> >
> > > Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> > > version of janino, calcite 1.29 uses the new version of janino and they
> > are
> > > not compatible.
> > > If I downgrade janino version to version which spark uses I got an
> error
> > > not method found exception
> > > If I upgrade the janino version to the version which calcite uses I get
> > the
> > > same error but with another method.
> > >
> > > As a result, I built a separate calcite jar package where I shaded
> janino
> > > dependency
> > >
> > >
> > >
> > > On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> > > estanilovskiy@gridgain.com> wrote:
> > >
> > > > for example on a current calcite branch:
> > > > grep janino gradle.properties
> > > > janino.version=3.1.6
> > > >
> > > >
> > > > > yes, we use drools in the same project,&nbsp; and drools uses
> janino
> > > > > too, is there a version list of janino which calcite supports?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ---Original---
> > > > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > > > Date: Fri, Feb 11, 2022 18:30 PM
> > > > > To: "dev"<dev@calcite.apache.org&gt;;
> > > > > Subject: Re: calcite multi-threading problem
> > > > >
> > > > >
> > > > > Hi!
> > > > >
> > > >
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > > > >
> > > >
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > > > >
> > > > >
> > > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > > > &gt;&nbsp;wrote:
> > > > >
> > > > > &gt;&nbsp;Hi,
> > > > > &gt;
> > > > > &gt;
> > > > >
> > > >
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > > > >
> > > >
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > > > &gt;&nbsp;this&nbsp;error
> > > > > &gt;
> > > > > &gt;
> > > > > &gt;
> > > > > &gt;
> > > > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > > > &gt;
> > > > >
> > > >
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > > > &gt;
> > > > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > > > &gt;
> > > > > &gt;
> > > > >
> > > >
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> > > >
> > >

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
Hi Stamatis,

Finally we are talking about the threading side about the problem,

can we open multiple connections from mutiple threads against the same ReflectiveSchema schema with the same target object ?






------------------ Original ------------------
From:  "Stamatis Zampetakis";<za...@gmail.com>;
Send time: Monday, Feb 14, 2022 5:49 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Hi,

I haven't gone through all the exchanges but wanted to mention that in
general the JDBC connection APIs are not thread-safe.

You previously mentioned the following:
"we open a calcite connection with ReflectiveSchema in one thread, and
execute sqls in other  threads against the connection, but failed with
this error"

This is not a supported use case. Every thread should have its own
connection and you shouldn't use the same connection instance from multiple
threads.

Best,
Stamatis

On Sat, Feb 12, 2022 at 2:14 PM xiaobo <gu...@qq.com.invalid> wrote:

> 3.1.4 of janino and commons-compiler works now.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 8:04 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:      calcite multi-threading problem
>
>
>
> but strange enough, the same code works in a single thread.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 8:02 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:     calcite multi-threading problem
>
>
>
> we checked the janino release note page
> http://janino-compiler.github.io/janino/changelog.html
>
> Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties
> in java 11: ICompilerFactories were loaded through the current thread's
> "context class loader", which is a bad choice in some environments. Thus,
> the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and
> "getCompilerFactory(className)" were duplicated and augmented with a
> "classLoader" parameter.
>
> what does this mean?  the getDefaultCompilerFactory method with a
> classloader parameter was removed intentionally?
> but it seems calcite still needs it , so what version of janino should we
> use for the latest calcite-core?
>
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 12:01 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:    calcite multi-threading problem
>
>
>
> In our use case, the Java class which opens calcite connection is
> contained in a external Java jar file, which is loaded dynamicly through
> classloaders other than the default systemloader like this:
>
>
> try {
>             ClassLoader loader = URLClassLoader.newInstance(
>                     new URL[] { new URL("jar:file:" + path + "!/") },
>                     getClass().getClassLoader());
>             Class<?> clazz = Class.forName(classPath, true, loader);
>
> we mention this because the error message shows a classloader parameter.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 11:56 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:   calcite multi-threading problem
>
>
>
> And if we remove calcite from our project,  janino is not in "resolved
> depencies" library list of pom.xml,
> So we think it not the janino conflic problem.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 9:49 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:  calcite multi-threading problem
>
>
>
> can you share the solution for the problem, we are using the following
> libraries, and it seems janino 3.1.6  is only dependent by calcite-core.
>
>     <properties>
>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>           <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
>           <java.version>9</java.version>
>           <maven.compiler.source>9</maven.compiler.source>
>           <maven.compiler.target>9</maven.compiler.target>
>         <log4j2.version>2.17.1</log4j2.version>
>         <drools.version>7.64.0.Final</drools.version>
>    </properties>
>
> <groupId>org.apache.calcite</groupId>
>             <artifactId>calcite-core</artifactId>
>             <version>1.29.0</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.calcite.avatica</groupId>
>             <artifactId>avatica-core</artifactId>
>             <version>1.20.0</version>
>         </dependency>
>
>
>     <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-core</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-compiler</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-decisiontables</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>
>
> ------------------ Original ------------------
> From:  "xiong duan";<no...@gmail.com>;
> Send time: Saturday, Feb 12, 2022 8:43 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re: calcite multi-threading problem
>
>
>
> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
>
> Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
>
> > Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> > version of janino, calcite 1.29 uses the new version of janino and they
> are
> > not compatible.
> > If I downgrade janino version to version which spark uses I got an error
> > not method found exception
> > If I upgrade the janino version to the version which calcite uses I get
> the
> > same error but with another method.
> >
> > As a result, I built a separate calcite jar package where I shaded janino
> > dependency
> >
> >
> >
> > On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> > estanilovskiy@gridgain.com> wrote:
> >
> > > for example on a current calcite branch:
> > > grep janino gradle.properties
> > > janino.version=3.1.6
> > >
> > >
> > > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > > too, is there a version list of janino which calcite supports?
> > > >
> > > >
> > > >
> > > >
> > > > ---Original---
> > > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > > Date: Fri, Feb 11, 2022 18:30 PM
> > > > To: "dev"<dev@calcite.apache.org&gt;;
> > > > Subject: Re: calcite multi-threading problem
> > > >
> > > >
> > > > Hi!
> > > >
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > > >
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > > >
> > > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > > &gt;&nbsp;wrote:
> > > >
> > > > &gt;&nbsp;Hi,
> > > > &gt;
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > > >
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > > &gt;&nbsp;this&nbsp;error
> > > > &gt;
> > > > &gt;
> > > > &gt;
> > > > &gt;
> > > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > > &gt;
> > > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > > &gt;
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> > >
> >

Re: calcite multi-threading problem

Posted by Stamatis Zampetakis <za...@gmail.com>.
Hi,

I haven't gone through all the exchanges but wanted to mention that in
general the JDBC connection APIs are not thread-safe.

You previously mentioned the following:
"we open a calcite connection with ReflectiveSchema in one thread, and
execute sqls in other  threads against the connection, but failed with
this error"

This is not a supported use case. Every thread should have its own
connection and you shouldn't use the same connection instance from multiple
threads.

Best,
Stamatis

On Sat, Feb 12, 2022 at 2:14 PM xiaobo <gu...@qq.com.invalid> wrote:

> 3.1.4 of janino and commons-compiler works now.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 8:04 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:      calcite multi-threading problem
>
>
>
> but strange enough, the same code works in a single thread.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 8:02 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:     calcite multi-threading problem
>
>
>
> we checked the janino release note page
> http://janino-compiler.github.io/janino/changelog.html
>
> Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties
> in java 11: ICompilerFactories were loaded through the current thread's
> "context class loader", which is a bad choice in some environments. Thus,
> the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and
> "getCompilerFactory(className)" were duplicated and augmented with a
> "classLoader" parameter.
>
> what does this mean?  the getDefaultCompilerFactory method with a
> classloader parameter was removed intentionally?
> but it seems calcite still needs it , so what version of janino should we
> use for the latest calcite-core?
>
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 12:01 PM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:    calcite multi-threading problem
>
>
>
> In our use case, the Java class which opens calcite connection is
> contained in a external Java jar file, which is loaded dynamicly through
> classloaders other than the default systemloader like this:
>
>
> try {
>             ClassLoader loader = URLClassLoader.newInstance(
>                     new URL[] { new URL("jar:file:" + path + "!/") },
>                     getClass().getClassLoader());
>             Class<?> clazz = Class.forName(classPath, true, loader);
>
> we mention this because the error message shows a classloader parameter.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 11:56 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:   calcite multi-threading problem
>
>
>
> And if we remove calcite from our project,  janino is not in "resolved
> depencies" library list of pom.xml,
> So we think it not the janino conflic problem.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<gu...@qq.com>;
> Send time: Saturday, Feb 12, 2022 9:49 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re:  calcite multi-threading problem
>
>
>
> can you share the solution for the problem, we are using the following
> libraries, and it seems janino 3.1.6  is only dependent by calcite-core.
>
>     <properties>
>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>           <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
>           <java.version>9</java.version>
>           <maven.compiler.source>9</maven.compiler.source>
>           <maven.compiler.target>9</maven.compiler.target>
>         <log4j2.version>2.17.1</log4j2.version>
>         <drools.version>7.64.0.Final</drools.version>
>    </properties>
>
> <groupId>org.apache.calcite</groupId>
>             <artifactId>calcite-core</artifactId>
>             <version>1.29.0</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.calcite.avatica</groupId>
>             <artifactId>avatica-core</artifactId>
>             <version>1.20.0</version>
>         </dependency>
>
>
>     <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-core</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-compiler</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.drools</groupId>
>             <artifactId>drools-decisiontables</artifactId>
>             <version>${drools.version}</version>
>         </dependency>
>
>
> ------------------ Original ------------------
> From:  "xiong duan";<no...@gmail.com>;
> Send time: Saturday, Feb 12, 2022 8:43 AM
> To: "dev"<de...@calcite.apache.org>;
>
> Subject:  Re: calcite multi-threading problem
>
>
>
> Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.
>
> Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:
>
> > Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> > version of janino, calcite 1.29 uses the new version of janino and they
> are
> > not compatible.
> > If I downgrade janino version to version which spark uses I got an error
> > not method found exception
> > If I upgrade the janino version to the version which calcite uses I get
> the
> > same error but with another method.
> >
> > As a result, I built a separate calcite jar package where I shaded janino
> > dependency
> >
> >
> >
> > On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> > estanilovskiy@gridgain.com> wrote:
> >
> > > for example on a current calcite branch:
> > > grep janino gradle.properties
> > > janino.version=3.1.6
> > >
> > >
> > > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > > too, is there a version list of janino which calcite supports?
> > > >
> > > >
> > > >
> > > >
> > > > ---Original---
> > > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > > Date: Fri, Feb 11, 2022 18:30 PM
> > > > To: "dev"<dev@calcite.apache.org&gt;;
> > > > Subject: Re: calcite multi-threading problem
> > > >
> > > >
> > > > Hi!
> > > >
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > > >
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > > >
> > > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > > &gt;&nbsp;wrote:
> > > >
> > > > &gt;&nbsp;Hi,
> > > > &gt;
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > > >
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > > &gt;&nbsp;this&nbsp;error
> > > > &gt;
> > > > &gt;
> > > > &gt;
> > > > &gt;
> > > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > > &gt;
> > > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > > &gt;
> > > > &gt;
> > > >
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> > >
> >

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
3.1.4 of janino and commons-compiler works now.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 8:04 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:      calcite multi-threading problem



but strange enough, the same code works in a single thread.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 8:02 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:     calcite multi-threading problem



we checked the janino release note page
http://janino-compiler.github.io/janino/changelog.html

Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some environments. Thus, the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and "getCompilerFactory(className)" were duplicated and augmented with a "classLoader" parameter. 

what does this mean?  the getDefaultCompilerFactory method with a classloader parameter was removed intentionally?
but it seems calcite still needs it , so what version of janino should we use for the latest calcite-core?





------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 12:01 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:    calcite multi-threading problem



In our use case, the Java class which opens calcite connection is contained in a external Java jar file, which is loaded dynamicly through classloaders other than the default systemloader like this:


try {
            ClassLoader loader = URLClassLoader.newInstance(
                    new URL[] { new URL("jar:file:" + path + "!/") },
                    getClass().getClassLoader());
            Class<?> clazz = Class.forName(classPath, true, loader);

we mention this because the error message shows a classloader parameter.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 11:56 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:   calcite multi-threading problem



And if we remove calcite from our project,  janino is not in "resolved depencies" library list of pom.xml,
So we think it not the janino conflic problem.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:49 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:  calcite multi-threading problem



can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6  is only dependent by calcite-core.

    <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <java.version>9</java.version>
          <maven.compiler.source>9</maven.compiler.source>
          <maven.compiler.target>9</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>
        <drools.version>7.64.0.Final</drools.version>
   </properties>

<groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.29.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica-core</artifactId>
            <version>1.20.0</version>
        </dependency>


    <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>


------------------ Original ------------------
From:  "xiong duan";<no...@gmail.com>;
Send time: Saturday, Feb 12, 2022 8:43 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
but strange enough, the same code works in a single thread.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 8:02 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:     calcite multi-threading problem



we checked the janino release note page
http://janino-compiler.github.io/janino/changelog.html

Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some environments. Thus, the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and "getCompilerFactory(className)" were duplicated and augmented with a "classLoader" parameter. 

what does this mean?  the getDefaultCompilerFactory method with a classloader parameter was removed intentionally?
but it seems calcite still needs it , so what version of janino should we use for the latest calcite-core?





------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 12:01 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:    calcite multi-threading problem



In our use case, the Java class which opens calcite connection is contained in a external Java jar file, which is loaded dynamicly through classloaders other than the default systemloader like this:


try {
            ClassLoader loader = URLClassLoader.newInstance(
                    new URL[] { new URL("jar:file:" + path + "!/") },
                    getClass().getClassLoader());
            Class<?> clazz = Class.forName(classPath, true, loader);

we mention this because the error message shows a classloader parameter.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 11:56 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:   calcite multi-threading problem



And if we remove calcite from our project,  janino is not in "resolved depencies" library list of pom.xml,
So we think it not the janino conflic problem.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:49 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:  calcite multi-threading problem



can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6  is only dependent by calcite-core.

    <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <java.version>9</java.version>
          <maven.compiler.source>9</maven.compiler.source>
          <maven.compiler.target>9</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>
        <drools.version>7.64.0.Final</drools.version>
   </properties>

<groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.29.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica-core</artifactId>
            <version>1.20.0</version>
        </dependency>


    <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>


------------------ Original ------------------
From:  "xiong duan";<no...@gmail.com>;
Send time: Saturday, Feb 12, 2022 8:43 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
we checked the janino release note page
http://janino-compiler.github.io/janino/changelog.html

Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some environments. Thus, the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and "getCompilerFactory(className)" were duplicated and augmented with a "classLoader" parameter. 

what does this mean?  the getDefaultCompilerFactory method with a classloader parameter was removed intentionally?
but it seems calcite still needs it , so what version of janino should we use for the latest calcite-core?





------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 12:01 PM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:    calcite multi-threading problem



In our use case, the Java class which opens calcite connection is contained in a external Java jar file, which is loaded dynamicly through classloaders other than the default systemloader like this:


try {
            ClassLoader loader = URLClassLoader.newInstance(
                    new URL[] { new URL("jar:file:" + path + "!/") },
                    getClass().getClassLoader());
            Class<?> clazz = Class.forName(classPath, true, loader);

we mention this because the error message shows a classloader parameter.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 11:56 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:   calcite multi-threading problem



And if we remove calcite from our project,  janino is not in "resolved depencies" library list of pom.xml,
So we think it not the janino conflic problem.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:49 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:  calcite multi-threading problem



can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6  is only dependent by calcite-core.

    <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <java.version>9</java.version>
          <maven.compiler.source>9</maven.compiler.source>
          <maven.compiler.target>9</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>
        <drools.version>7.64.0.Final</drools.version>
   </properties>

<groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.29.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica-core</artifactId>
            <version>1.20.0</version>
        </dependency>


    <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>


------------------ Original ------------------
From:  "xiong duan";<no...@gmail.com>;
Send time: Saturday, Feb 12, 2022 8:43 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
In our use case, the Java class which opens calcite connection is contained in a external Java jar file, which is loaded dynamicly through classloaders other than the default systemloader like this:


try {
            ClassLoader loader = URLClassLoader.newInstance(
                    new URL[] { new URL("jar:file:" + path + "!/") },
                    getClass().getClassLoader());
            Class<?> clazz = Class.forName(classPath, true, loader);

we mention this because the error message shows a classloader parameter.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 11:56 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:   calcite multi-threading problem



And if we remove calcite from our project,  janino is not in "resolved depencies" library list of pom.xml,
So we think it not the janino conflic problem.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:49 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:  calcite multi-threading problem



can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6  is only dependent by calcite-core.

    <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <java.version>9</java.version>
          <maven.compiler.source>9</maven.compiler.source>
          <maven.compiler.target>9</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>
        <drools.version>7.64.0.Final</drools.version>
   </properties>

<groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.29.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica-core</artifactId>
            <version>1.20.0</version>
        </dependency>


    <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>


------------------ Original ------------------
From:  "xiong duan";<no...@gmail.com>;
Send time: Saturday, Feb 12, 2022 8:43 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
And if we remove calcite from our project,  janino is not in "resolved depencies" library list of pom.xml,
So we think it not the janino conflic problem.




------------------ Original ------------------
From:  "xiaobo ";<gu...@qq.com>;
Send time: Saturday, Feb 12, 2022 9:49 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re:  calcite multi-threading problem



can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6  is only dependent by calcite-core.

    <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <java.version>9</java.version>
          <maven.compiler.source>9</maven.compiler.source>
          <maven.compiler.target>9</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>
        <drools.version>7.64.0.Final</drools.version>
   </properties>

<groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.29.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica-core</artifactId>
            <version>1.20.0</version>
        </dependency>


    <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>


------------------ Original ------------------
From:  "xiong duan";<no...@gmail.com>;
Send time: Saturday, Feb 12, 2022 8:43 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
can you share the solution for the problem, we are using the following libraries, and it seems janino 3.1.6  is only dependent by calcite-core.

    <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <java.version>9</java.version>
          <maven.compiler.source>9</maven.compiler.source>
          <maven.compiler.target>9</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>
        <drools.version>7.64.0.Final</drools.version>
   </properties>

<groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.29.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica-core</artifactId>
            <version>1.20.0</version>
        </dependency>


    <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <version>${drools.version}</version>
        </dependency>


------------------ Original ------------------
From:  "xiong duan";<no...@gmail.com>;
Send time: Saturday, Feb 12, 2022 8:43 AM
To: "dev"<de...@calcite.apache.org>; 

Subject:  Re: calcite multi-threading problem



Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

Re: calcite multi-threading problem

Posted by xiong duan <no...@gmail.com>.
Yes, It is a dependency issue. I have met the same problem. +1 for Dmitry.

Dmitry Sysolyatin <dm...@gmail.com> 于2022年2月11日周五 21:18写道:

> Actually, I had the same problem with spark. Spark 3.2.1 uses the old
> version of janino, calcite 1.29 uses the new version of janino and they are
> not compatible.
> If I downgrade janino version to version which spark uses I got an error
> not method found exception
> If I upgrade the janino version to the version which calcite uses I get the
> same error but with another method.
>
> As a result, I built a separate calcite jar package where I shaded janino
> dependency
>
>
>
> On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
> estanilovskiy@gridgain.com> wrote:
>
> > for example on a current calcite branch:
> > grep janino gradle.properties
> > janino.version=3.1.6
> >
> >
> > > yes, we use drools in the same project,&nbsp; and drools uses janino
> > > too, is there a version list of janino which calcite supports?
> > >
> > >
> > >
> > >
> > > ---Original---
> > > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > > Date: Fri, Feb 11, 2022 18:30 PM
> > > To: "dev"<dev@calcite.apache.org&gt;;
> > > Subject: Re: calcite multi-threading problem
> > >
> > >
> > > Hi!
> > >
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> > >
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > > calcite&nbsp;requires&nbsp;another&nbsp;one
> > >
> > >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> > &gt;&nbsp;wrote:
> > >
> > > &gt;&nbsp;Hi,
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> > >
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > > &gt;&nbsp;this&nbsp;error
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;
> > > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > > &gt;&nbsp;java.lang.NoSuchMethodError:
> > > &gt;
> > >
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > > &gt;
> > > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > > &gt;
> > > &gt;
> > >
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
> >
>

回复:reply: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
I mean it seems not a janino related problem, if we put the connection opening and sql executing operationes in the same thread the&nbsp; same error does not appear, but with a sql related problem with I sent in another mail.




------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "xiaobo "                                                                                    <guxiaobo1982@qq.com&gt;;
发送时间:&nbsp;2022年2月11日(星期五) 晚上10:46
收件人:&nbsp;"dev"<dev@calcite.apache.org&gt;;

主题:&nbsp;reply: calcite multi-threading problem



we use maven and the effective pom contains only the 3.1.0 version of janino as following:


<properties&gt;
&nbsp; &nbsp; ...
&nbsp; &nbsp; <janino.version&gt;3.1.0</janino.version&gt;

...
&nbsp;<dependency&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <groupId&gt;org.codehaus.janino</groupId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <artifactId&gt;commons-compiler</artifactId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <version&gt;3.1.0</version&gt;
&nbsp;&nbsp;&nbsp; &nbsp; </dependency&gt;
&nbsp;&nbsp;&nbsp; &nbsp; <dependency&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <groupId&gt;org.codehaus.janino</groupId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <artifactId&gt;commons-compiler-jdk</artifactId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <version&gt;3.1.0</version&gt;
&nbsp;&nbsp;&nbsp; &nbsp; </dependency&gt;
&nbsp;&nbsp;&nbsp; &nbsp; <dependency&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <groupId&gt;org.codehaus.janino</groupId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <artifactId&gt;janino</artifactId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <version&gt;3.1.0</version&gt;
&nbsp;&nbsp;&nbsp; &nbsp; </dependency&gt;


there is no other dependent versions of janino





------------------ 原始邮件 ------------------
发件人:                                                                                                                        "dev"                                                                                    <dm.sysolyatin@gmail.com&gt;;
发送时间:&nbsp;2022年2月11日(星期五) 晚上9:18
收件人:&nbsp;"dev"<dev@calcite.apache.org&gt;;

主题:&nbsp;Re: calcite multi-threading problem



Actually, I had the same problem with spark. Spark 3.2.1 uses the old
version of janino, calcite 1.29 uses the new version of janino and they are
not compatible.
If I downgrade janino version to version which spark uses I got an error
not method found exception
If I upgrade the janino version to the version which calcite uses I get the
same error but with another method.

As a result, I built a separate calcite jar package where I shaded janino
dependency



On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
estanilovskiy@gridgain.com&gt; wrote:

&gt; for example on a current calcite branch:
&gt; grep janino gradle.properties
&gt; janino.version=3.1.6
&gt;
&gt;
&gt; &gt; yes, we use drools in the same project,&amp;nbsp; and drools uses janino
&gt; &gt; too, is there a version list of janino which calcite supports?
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; ---Original---
&gt; &gt; From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&amp;gt;
&gt; &gt; Date: Fri, Feb 11, 2022 18:30 PM
&gt; &gt; To: "dev"<dev@calcite.apache.org&amp;gt;;
&gt; &gt; Subject: Re: calcite multi-threading problem
&gt; &gt;
&gt; &gt;
&gt; &gt; Hi!
&gt; &gt;
&gt; It&amp;nbsp;looks&amp;nbsp;like&amp;nbsp;a&amp;nbsp;dependency&amp;nbsp;issue,&amp;nbsp;not&amp;nbsp;like&amp;nbsp;a&amp;nbsp;multi-threading&amp;nbsp;issue.&amp;nbsp;Most
&gt; &gt;
&gt; likely&amp;nbsp;you&amp;nbsp;have&amp;nbsp;some&amp;nbsp;dependency&amp;nbsp;that&amp;nbsp;use&amp;nbsp;another&amp;nbsp;version&amp;nbsp;of&amp;nbsp;janino&amp;nbsp;but
&gt; &gt; calcite&amp;nbsp;requires&amp;nbsp;another&amp;nbsp;one
&gt; &gt;
&gt; &gt;
&gt; On&amp;nbsp;Fri,&amp;nbsp;Feb&amp;nbsp;11,&amp;nbsp;2022&amp;nbsp;at&amp;nbsp;12:18&amp;nbsp;PM&amp;nbsp;xiaobo&amp;nbsp;<guxiaobo1982@qq.com.invalid
&gt; &amp;gt;&amp;nbsp;wrote:
&gt; &gt;
&gt; &gt; &amp;gt;&amp;nbsp;Hi,
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;we&amp;nbsp;open&amp;nbsp;a&amp;nbsp;calcite&amp;nbsp;connection&amp;nbsp;with&amp;nbsp;ReflectiveSchema&amp;nbsp;in&amp;nbsp;one&amp;nbsp;thread,&amp;nbsp;and
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;execute&amp;nbsp;sqls&amp;nbsp;in&amp;nbsp;other&amp;nbsp;&amp;nbsp;threads&amp;nbsp;against&amp;nbsp;the&amp;nbsp;connection,&amp;nbsp;but&amp;nbsp;failed&amp;nbsp;with
&gt; &gt; &amp;gt;&amp;nbsp;this&amp;nbsp;error
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;&amp;nbsp;com.google.common.util.concurrent.ExecutionError:
&gt; &gt; &amp;gt;&amp;nbsp;java.lang.NoSuchMethodError:
&gt; &gt; &amp;gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;&amp;nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;do&amp;nbsp;we&amp;nbsp;miss&amp;nbsp;anything&amp;nbsp;regarding&amp;nbsp;to&amp;nbsp;multi-threading&amp;nbsp;with&amp;nbsp;calcite?
&gt;

reply: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
we use maven and the effective pom contains only the 3.1.0 version of janino as following:


<properties&gt;
&nbsp;&nbsp;&nbsp; ...
&nbsp;&nbsp;&nbsp; <janino.version&gt;3.1.0</janino.version&gt;

...
&nbsp;<dependency&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <groupId&gt;org.codehaus.janino</groupId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <artifactId&gt;commons-compiler</artifactId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <version&gt;3.1.0</version&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <groupId&gt;org.codehaus.janino</groupId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <artifactId&gt;commons-compiler-jdk</artifactId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <version&gt;3.1.0</version&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <dependency&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <groupId&gt;org.codehaus.janino</groupId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <artifactId&gt;janino</artifactId&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <version&gt;3.1.0</version&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </dependency&gt;


there is no other dependent versions of janino





------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "dev"                                                                                    <dm.sysolyatin@gmail.com&gt;;
发送时间:&nbsp;2022年2月11日(星期五) 晚上9:18
收件人:&nbsp;"dev"<dev@calcite.apache.org&gt;;

主题:&nbsp;Re: calcite multi-threading problem



Actually, I had the same problem with spark. Spark 3.2.1 uses the old
version of janino, calcite 1.29 uses the new version of janino and they are
not compatible.
If I downgrade janino version to version which spark uses I got an error
not method found exception
If I upgrade the janino version to the version which calcite uses I get the
same error but with another method.

As a result, I built a separate calcite jar package where I shaded janino
dependency



On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
estanilovskiy@gridgain.com&gt; wrote:

&gt; for example on a current calcite branch:
&gt; grep janino gradle.properties
&gt; janino.version=3.1.6
&gt;
&gt;
&gt; &gt; yes, we use drools in the same project,&amp;nbsp; and drools uses janino
&gt; &gt; too, is there a version list of janino which calcite supports?
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; ---Original---
&gt; &gt; From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&amp;gt;
&gt; &gt; Date: Fri, Feb 11, 2022 18:30 PM
&gt; &gt; To: "dev"<dev@calcite.apache.org&amp;gt;;
&gt; &gt; Subject: Re: calcite multi-threading problem
&gt; &gt;
&gt; &gt;
&gt; &gt; Hi!
&gt; &gt;
&gt; It&amp;nbsp;looks&amp;nbsp;like&amp;nbsp;a&amp;nbsp;dependency&amp;nbsp;issue,&amp;nbsp;not&amp;nbsp;like&amp;nbsp;a&amp;nbsp;multi-threading&amp;nbsp;issue.&amp;nbsp;Most
&gt; &gt;
&gt; likely&amp;nbsp;you&amp;nbsp;have&amp;nbsp;some&amp;nbsp;dependency&amp;nbsp;that&amp;nbsp;use&amp;nbsp;another&amp;nbsp;version&amp;nbsp;of&amp;nbsp;janino&amp;nbsp;but
&gt; &gt; calcite&amp;nbsp;requires&amp;nbsp;another&amp;nbsp;one
&gt; &gt;
&gt; &gt;
&gt; On&amp;nbsp;Fri,&amp;nbsp;Feb&amp;nbsp;11,&amp;nbsp;2022&amp;nbsp;at&amp;nbsp;12:18&amp;nbsp;PM&amp;nbsp;xiaobo&amp;nbsp;<guxiaobo1982@qq.com.invalid
&gt; &amp;gt;&amp;nbsp;wrote:
&gt; &gt;
&gt; &gt; &amp;gt;&amp;nbsp;Hi,
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;we&amp;nbsp;open&amp;nbsp;a&amp;nbsp;calcite&amp;nbsp;connection&amp;nbsp;with&amp;nbsp;ReflectiveSchema&amp;nbsp;in&amp;nbsp;one&amp;nbsp;thread,&amp;nbsp;and
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;execute&amp;nbsp;sqls&amp;nbsp;in&amp;nbsp;other&amp;nbsp;&amp;nbsp;threads&amp;nbsp;against&amp;nbsp;the&amp;nbsp;connection,&amp;nbsp;but&amp;nbsp;failed&amp;nbsp;with
&gt; &gt; &amp;gt;&amp;nbsp;this&amp;nbsp;error
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;&amp;nbsp;com.google.common.util.concurrent.ExecutionError:
&gt; &gt; &amp;gt;&amp;nbsp;java.lang.NoSuchMethodError:
&gt; &gt; &amp;gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;&amp;nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
&gt; &gt; &amp;gt;
&gt; &gt; &amp;gt;
&gt; &gt;
&gt; &amp;gt;&amp;nbsp;do&amp;nbsp;we&amp;nbsp;miss&amp;nbsp;anything&amp;nbsp;regarding&amp;nbsp;to&amp;nbsp;multi-threading&amp;nbsp;with&amp;nbsp;calcite?
&gt;

Re: calcite multi-threading problem

Posted by Dmitry Sysolyatin <dm...@gmail.com>.
Actually, I had the same problem with spark. Spark 3.2.1 uses the old
version of janino, calcite 1.29 uses the new version of janino and they are
not compatible.
If I downgrade janino version to version which spark uses I got an error
not method found exception
If I upgrade the janino version to the version which calcite uses I get the
same error but with another method.

As a result, I built a separate calcite jar package where I shaded janino
dependency



On Fri, Feb 11, 2022 at 2:39 PM stanilovsky evgeny <
estanilovskiy@gridgain.com> wrote:

> for example on a current calcite branch:
> grep janino gradle.properties
> janino.version=3.1.6
>
>
> > yes, we use drools in the same project,&nbsp; and drools uses janino
> > too, is there a version list of janino which calcite supports?
> >
> >
> >
> >
> > ---Original---
> > From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> > Date: Fri, Feb 11, 2022 18:30 PM
> > To: "dev"<dev@calcite.apache.org&gt;;
> > Subject: Re: calcite multi-threading problem
> >
> >
> > Hi!
> >
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> >
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> > calcite&nbsp;requires&nbsp;another&nbsp;one
> >
> >
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid
> &gt;&nbsp;wrote:
> >
> > &gt;&nbsp;Hi,
> > &gt;
> > &gt;
> >
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> >
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> > &gt;&nbsp;this&nbsp;error
> > &gt;
> > &gt;
> > &gt;
> > &gt;
> > &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> > &gt;&nbsp;java.lang.NoSuchMethodError:
> > &gt;
> >
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> > &gt;
> > &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> > &gt;
> > &gt;
> >
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?
>

Re: calcite multi-threading problem

Posted by stanilovsky evgeny <es...@gridgain.com>.
for example on a current calcite branch:
grep janino gradle.properties
janino.version=3.1.6


> yes, we use drools in the same project,&nbsp; and drools uses janino  
> too, is there a version list of janino which calcite supports?
>
>
>
>
> ---Original---
> From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
> Date: Fri, Feb 11, 2022 18:30 PM
> To: "dev"<dev@calcite.apache.org&gt;;
> Subject: Re: calcite multi-threading problem
>
>
> Hi!
> It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
> likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
> calcite&nbsp;requires&nbsp;another&nbsp;one
>
> On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid&gt;&nbsp;wrote:
>
> &gt;&nbsp;Hi,
> &gt;
> &gt;
> &gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
> &gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
> &gt;&nbsp;this&nbsp;error
> &gt;
> &gt;
> &gt;
> &gt;
> &gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
> &gt;&nbsp;java.lang.NoSuchMethodError:
> &gt;
> &gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
> &gt;
> &gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
> &gt;
> &gt;
> &gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
yes, we use drools in the same project,&nbsp; and drools uses janino too, is there a version list of janino which calcite supports?




---Original---
From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
Date: Fri, Feb 11, 2022 18:30 PM
To: "dev"<dev@calcite.apache.org&gt;;
Subject: Re: calcite multi-threading problem


Hi!
It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
calcite&nbsp;requires&nbsp;another&nbsp;one

On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid&gt;&nbsp;wrote:

&gt;&nbsp;Hi,
&gt;
&gt;
&gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
&gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
&gt;&nbsp;this&nbsp;error
&gt;
&gt;
&gt;
&gt;
&gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
&gt;&nbsp;java.lang.NoSuchMethodError:
&gt;
&gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
&gt;
&gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
&gt;
&gt;
&gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?

Re: calcite multi-threading problem

Posted by xiaobo <gu...@qq.com.INVALID>.
yes, we use drools in the same project,&nbsp; and drools uses janino too, is there a version list of janino which janino supports?



---Original---
From: "Dmitry Sysolyatin"<dm.sysolyatin@gmail.com&gt;
Date: Fri, Feb 11, 2022 18:30 PM
To: "dev"<dev@calcite.apache.org&gt;;
Subject: Re: calcite multi-threading problem


Hi!
It&nbsp;looks&nbsp;like&nbsp;a&nbsp;dependency&nbsp;issue,&nbsp;not&nbsp;like&nbsp;a&nbsp;multi-threading&nbsp;issue.&nbsp;Most
likely&nbsp;you&nbsp;have&nbsp;some&nbsp;dependency&nbsp;that&nbsp;use&nbsp;another&nbsp;version&nbsp;of&nbsp;janino&nbsp;but
calcite&nbsp;requires&nbsp;another&nbsp;one

On&nbsp;Fri,&nbsp;Feb&nbsp;11,&nbsp;2022&nbsp;at&nbsp;12:18&nbsp;PM&nbsp;xiaobo&nbsp;<guxiaobo1982@qq.com.invalid&gt;&nbsp;wrote:

&gt;&nbsp;Hi,
&gt;
&gt;
&gt;&nbsp;we&nbsp;open&nbsp;a&nbsp;calcite&nbsp;connection&nbsp;with&nbsp;ReflectiveSchema&nbsp;in&nbsp;one&nbsp;thread,&nbsp;and
&gt;&nbsp;execute&nbsp;sqls&nbsp;in&nbsp;other&nbsp;&nbsp;threads&nbsp;against&nbsp;the&nbsp;connection,&nbsp;but&nbsp;failed&nbsp;with
&gt;&nbsp;this&nbsp;error
&gt;
&gt;
&gt;
&gt;
&gt;&nbsp;com.google.common.util.concurrent.ExecutionError:
&gt;&nbsp;java.lang.NoSuchMethodError:
&gt;
&gt;&nbsp;org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
&gt;
&gt;&nbsp;Lorg/codehaus/commons/compiler/ICompilerFactory;
&gt;
&gt;
&gt;&nbsp;do&nbsp;we&nbsp;miss&nbsp;anything&nbsp;regarding&nbsp;to&nbsp;multi-threading&nbsp;with&nbsp;calcite?

Re: calcite multi-threading problem

Posted by Dmitry Sysolyatin <dm...@gmail.com>.
Hi!
It looks like a dependency issue, not like a multi-threading issue. Most
likely you have some dependency that use another version of janino but
calcite requires another one

On Fri, Feb 11, 2022 at 12:18 PM xiaobo <gu...@qq.com.invalid> wrote:

> Hi,
>
>
> we open a calcite connection with ReflectiveSchema in one thread, and
> execute sqls in other  threads against the connection, but failed with
> this error
>
>
>
>
> com.google.common.util.concurrent.ExecutionError:
> java.lang.NoSuchMethodError:
>
> org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)
>
> Lorg/codehaus/commons/compiler/ICompilerFactory;
>
>
> do we miss anything regarding to multi-threading with calcite?