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";<zabe...@gmail.com>;
Send time: Monday, Feb 14, 2022 5:49 PM
To: "dev"<dev@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 <guxiaobo1...@qq.com.invalid> wrote:

> 3.1.4 of janino and commons-compiler works now.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<guxiaobo1...@qq.com>;
> Send time: Saturday, Feb 12, 2022 8:04 PM
> To: "dev"<dev@calcite.apache.org>;
>
> Subject:  Re:      calcite multi-threading problem
>
>
>
> but strange enough, the same code works in a single thread.
>
>
>
>
> ------------------ Original ------------------
> From:  "xiaobo ";<guxiaobo1...@qq.com>;
> Send time: Saturday, Feb 12, 2022 8:02 PM
> To: "dev"<dev@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 ";<guxiaobo1...@qq.com>;
> Send time: Saturday, Feb 12, 2022 12:01 PM
> To: "dev"<dev@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 ";<guxiaobo1...@qq.com>;
> Send time: Saturday, Feb 12, 2022 11:56 AM
> To: "dev"<dev@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 ";<guxiaobo1...@qq.com>;
> Send time: Saturday, Feb 12, 2022 9:49 AM
> To: "dev"<dev@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";<nobigo...@gmail.com>;
> Send time: Saturday, Feb 12, 2022 8:43 AM
> To: "dev"<dev@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.sysolya...@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 <
> > estanilovs...@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.sysolya...@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;<guxiaobo1...@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 via email to