You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Rakesh Nair <19...@gmail.com> on 2019/04/16 13:33:45 UTC

Connecting Calcite with Apache Phoenix

Hi,
So I've trying to connect Calcite with Apache Phoenix. Code given below:

*public Frameworks.ConfigBuilder configPhoenix() {*
* SchemaPlus rootSchema = Frameworks.createRootSchema(true);*

* DataSource dataSource =
JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure",
"org.apache.phoenix.jdbc.PhoenixDriver", null, null);*
* JdbcSchema schema = JdbcSchema.create(rootSchema, "hbase-unsecure",
dataSource, null, "hbase-unsecure");*
* for (String table : schema.getTableNames()) {*
* logger.info <http://logger.info>(table);*
* rootSchema.add(table, schema.getTable(table));*
* }*
* return Frameworks.newConfigBuilder().defaultSchema(rootSchema);*
* }*
*public static void main(String[] args) throws Exception {*
*FrameworkConfig config = configPhoenix().build();RelBuilder builder =
RelBuilder.create(config);*
*}*

Unfortunately I'm getting following error:

*Exception in thread "main" java.lang.RuntimeException:
java.sql.SQLException: Cannot create PoolableConnectionFactory
(java.lang.VerifyError: class com.google.protobuf.LiteralByteString
overrides final method toString.(Ljava/lang/String;)Ljava/lang/String;)*
* at
org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)*
* at
org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)*
* at org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)*
* at org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)*

I presume this is happening because Protobuf 3+ jar is present in classpath
for use by Calcite while Phoenix actually requires Protobuf 2.5.0.

So could someone tell me whether I'm doing something wrong here or if not,
then , how to handle this?

Regards,
Rakesh

Re: Connecting Calcite with Apache Phoenix

Posted by Rakesh Nair <19...@gmail.com>.
Hello Michael,
Happy to let you know that the shaded jar worked. Thanks for the assist.

Regards,
Rakesh.

On Thu, Apr 18, 2019 at 5:27 AM Michael Mior <mm...@apache.org> wrote:

> I took a closer look at this myself and it's more complicated than I
> was hoping. You might be able to work with the shaded JAR instead.
>
> https://mvnrepository.com/artifact/org.apache.calcite.avatica/avatica
>
> --
> Michael Mior
> mmior@apache.org
>
> Le mer. 17 avr. 2019 à 17:50, Rakesh Nair <19...@gmail.com> a
> écrit :
> >
> > Hello Michael,
> > Would you mind elaborating a bit on how to accomplish this?
> >
> > Regards,
> > Rakesh
> >
> > On Wed, Apr 17, 2019 at 11:04 PM Michael Mior <mm...@apache.org> wrote:
> >
> > > This dependency is due to files which were automatically generated
> > > with version 3 of the protobuf. You should hopefully be able to
> > > regenerate these files with version 2 to remove the dependency.
> > > --
> > > Michael Mior
> > > mmior@apache.org
> > >
> > > Le mer. 17 avr. 2019 à 03:56, Rakesh Nair <19...@gmail.com> a
> > > écrit :
> > > >
> > > > Hi Chunwei,
> > > > I do not believe that is gonna work because, to my understanding,
> Calcite
> > > > has internal dependency on *com/google/protobuf/GeneratedMessageV3
> *which
> > > > is only available in Protobuf version 3+ onwards. Error trace:-
> > > >
> > > > *Exception in thread "main" java.lang.NoClassDefFoundError:
> > > > com/google/protobuf/GeneratedMessageV3*
> > > > * at java.lang.ClassLoader.defineClass1(Native Method)*
> > > > * at java.lang.ClassLoader.defineClass(ClassLoader.java:763)*
> > > > * at
> > > >
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)*
> > > > * at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)*
> > > > * at java.net.URLClassLoader.access$100(URLClassLoader.java:73)*
> > > > * at java.net.URLClassLoader$1.run(URLClassLoader.java:368)*
> > > > * at java.net.URLClassLoader$1.run(URLClassLoader.java:362)*
> > > > * at java.security.AccessController.doPrivileged(Native Method)*
> > > > * at java.net.URLClassLoader.findClass(URLClassLoader.java:361)*
> > > > * at java.lang.ClassLoader.loadClass(ClassLoader.java:424)*
> > > > * at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)*
> > > > * at java.lang.ClassLoader.loadClass(ClassLoader.java:357)*
> > > > * at
> > > >
> > >
> org.apache.calcite.avatica.ConnectionPropertiesImpl.<clinit>(ConnectionPropertiesImpl.java:38)*
> > > > * at org.apache.calcite.avatica.MetaImpl.<init>(MetaImpl.java:72)*
> > > > * at
> > > >
> org.apache.calcite.jdbc.CalciteMetaImpl.<init>(CalciteMetaImpl.java:85)*
> > > > * at org.apache.calcite.jdbc.Driver.createMeta(Driver.java:169)*
> > > > * at
> > > >
> > >
> org.apache.calcite.avatica.AvaticaConnection.<init>(AvaticaConnection.java:121)*
> > > > *        at
> > > >
> > >
> org.apache.calcite.jdbc.CalciteConnectionImpl.<init>(CalciteConnectionImpl.java:118)*
> > > > * at
> > > >
> > >
> org.apache.calcite.jdbc.CalciteJdbc41Factory$CalciteJdbc41Connection.<init>(CalciteJdbc41Factory.java:115)*
> > > > * at
> > > >
> > >
> org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:59)*
> > > > * at
> > > >
> > >
> org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:1)*
> > > > * at
> > > >
> > >
> org.apache.calcite.jdbc.CalciteFactory.newConnection(CalciteFactory.java:53)*
> > > > * at
> > > >
> > >
> org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:138)*
> > > > * at java.sql.DriverManager.getConnection(DriverManager.java:664)*
> > > > * at java.sql.DriverManager.getConnection(DriverManager.java:208)*
> > > > *        at
> > > > org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:153)*
> > > > * at org.apache.calcite.tools.RelBuilder.create(RelBuilder.java:209)*
> > > >
> > > > Is there any other alternate way I can use making this connection?
> > > >
> > > > Regards,
> > > > Rakesh
> > > >
> > > > On Wed, Apr 17, 2019 at 12:59 PM Chunwei Lei <chunwei.leii@gmail.com
> >
> > > wrote:
> > > >
> > > > > Hi, Rakesh
> > > > >
> > > > > I find that it says Protobuf doesn't provide source/binary
> > > > > compatibility across different versions after searching the error
> > > > > message using google[1].
> > > > >
> > > > > Maybe you can try to compile source code of Calcite which uses the
> > > > > same version of Protobuf in Phoenix. But I am not sure that it can
> > > > > work.
> > > > >
> > > > >
> > > > > [1] https://groups.google.com/forum/#!topic/protobuf/N8rznIMcwWg
> > > > >
> > > > >
> > > > > Bests,
> > > > > Chunwei
> > > > >
> > > > > Rakesh Nair <19...@gmail.com> 于2019年4月17日周三 下午3:03写道:
> > > > > >
> > > > > > Hi,
> > > > > > Could someone kindly help me with the problem I'm facing in my
> > > previous
> > > > > > email? I've been sitting on this for some time now and would
> really
> > > like
> > > > > to
> > > > > > solve it.
> > > > > > For what it's worth, these are the dependencies I'm using,
> > > > > > *<dependencies>*
> > > > > > * <!--
> > > > > https://mvnrepository.com/artifact/org.apache.calcite/calcite-core
> > > > > > <
> https://mvnrepository.com/artifact/org.apache.calcite/calcite-core>
> > > > > -->*
> > > > > > * <dependency>*
> > > > > > * <groupId>org.apache.calcite</groupId>*
> > > > > > * <artifactId>calcite-core</artifactId>*
> > > > > > * <version>1.19.0</version>*
> > > > > > * </dependency>*
> > > > > > * <!--
> > > > > https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core
> > > > > > <
> https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core>
> > > > > -->*
> > > > > > * <dependency>*
> > > > > > * <groupId>org.apache.phoenix</groupId>*
> > > > > > * <artifactId>phoenix-core</artifactId>*
> > > > > > * <version>5.0.0.3.0.1.0-187</version>*
> > > > > > * </dependency>*
> > > > > > * </dependencies>*
> > > > > > * <repositories>*
> > > > > > * <repository>*
> > > > > > * <id>Hortonworks Repository</id>*
> > > > > > * <url>
> http://repo.hortonworks.com/content/repositories/releases/
> > > > > > <http://repo.hortonworks.com/content/repositories/releases/
> ></url>*
> > > > > > * </repository>*
> > > > > > * </repositories>*
> > > > > >
> > > > > > Waiting for you response.
> > > > > > Regards,
> > > > > > Rakesh.
> > > > > >
> > > > > > On Tue, Apr 16, 2019 at 7:03 PM Rakesh Nair <
> > > 1994hsekar1994@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > > So I've trying to connect Calcite with Apache Phoenix. Code
> given
> > > > > below:
> > > > > > >
> > > > > > > *public Frameworks.ConfigBuilder configPhoenix() {*
> > > > > > > * SchemaPlus rootSchema = Frameworks.createRootSchema(true);*
> > > > > > >
> > > > > > > * DataSource dataSource =
> > > > > > >
> JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure",
> > > > > > > "org.apache.phoenix.jdbc.PhoenixDriver", null, null);*
> > > > > > > * JdbcSchema schema = JdbcSchema.create(rootSchema,
> > > "hbase-unsecure",
> > > > > > > dataSource, null, "hbase-unsecure");*
> > > > > > > * for (String table : schema.getTableNames()) {*
> > > > > > > * logger.info <http://logger.info>(table);*
> > > > > > > * rootSchema.add(table, schema.getTable(table));*
> > > > > > > * }*
> > > > > > > * return
> Frameworks.newConfigBuilder().defaultSchema(rootSchema);*
> > > > > > > * }*
> > > > > > > *public static void main(String[] args) throws Exception {*
> > > > > > > *FrameworkConfig config = configPhoenix().build();RelBuilder
> > > builder =
> > > > > > > RelBuilder.create(config);*
> > > > > > > *}*
> > > > > > >
> > > > > > > Unfortunately I'm getting following error:
> > > > > > >
> > > > > > > *Exception in thread "main" java.lang.RuntimeException:
> > > > > > > java.sql.SQLException: Cannot create PoolableConnectionFactory
> > > > > > > (java.lang.VerifyError: class
> com.google.protobuf.LiteralByteString
> > > > > > > overrides final method
> > > > > toString.(Ljava/lang/String;)Ljava/lang/String;)*
> > > > > > > * at
> > > > > > >
> > > > >
> > >
> org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)*
> > > > > > > * at
> > > > > > >
> > > > >
> > >
> org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)*
> > > > > > > * at
> > > > > > >
> > > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)*
> > > > > > > * at
> > > > > > >
> > > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)*
> > > > > > >
> > > > > > > I presume this is happening because Protobuf 3+ jar is present
> in
> > > > > > > classpath for use by Calcite while Phoenix actually requires
> > > Protobuf
> > > > > 2.5.0.
> > > > > > >
> > > > > > > So could someone tell me whether I'm doing something wrong
> here or
> > > if
> > > > > not,
> > > > > > > then , how to handle this?
> > > > > > >
> > > > > > > Regards,
> > > > > > > Rakesh
> > > > > > >
> > > > >
> > >
>

Re: Connecting Calcite with Apache Phoenix

Posted by Michael Mior <mm...@apache.org>.
I took a closer look at this myself and it's more complicated than I
was hoping. You might be able to work with the shaded JAR instead.

https://mvnrepository.com/artifact/org.apache.calcite.avatica/avatica

--
Michael Mior
mmior@apache.org

Le mer. 17 avr. 2019 à 17:50, Rakesh Nair <19...@gmail.com> a écrit :
>
> Hello Michael,
> Would you mind elaborating a bit on how to accomplish this?
>
> Regards,
> Rakesh
>
> On Wed, Apr 17, 2019 at 11:04 PM Michael Mior <mm...@apache.org> wrote:
>
> > This dependency is due to files which were automatically generated
> > with version 3 of the protobuf. You should hopefully be able to
> > regenerate these files with version 2 to remove the dependency.
> > --
> > Michael Mior
> > mmior@apache.org
> >
> > Le mer. 17 avr. 2019 à 03:56, Rakesh Nair <19...@gmail.com> a
> > écrit :
> > >
> > > Hi Chunwei,
> > > I do not believe that is gonna work because, to my understanding, Calcite
> > > has internal dependency on *com/google/protobuf/GeneratedMessageV3 *which
> > > is only available in Protobuf version 3+ onwards. Error trace:-
> > >
> > > *Exception in thread "main" java.lang.NoClassDefFoundError:
> > > com/google/protobuf/GeneratedMessageV3*
> > > * at java.lang.ClassLoader.defineClass1(Native Method)*
> > > * at java.lang.ClassLoader.defineClass(ClassLoader.java:763)*
> > > * at
> > > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)*
> > > * at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)*
> > > * at java.net.URLClassLoader.access$100(URLClassLoader.java:73)*
> > > * at java.net.URLClassLoader$1.run(URLClassLoader.java:368)*
> > > * at java.net.URLClassLoader$1.run(URLClassLoader.java:362)*
> > > * at java.security.AccessController.doPrivileged(Native Method)*
> > > * at java.net.URLClassLoader.findClass(URLClassLoader.java:361)*
> > > * at java.lang.ClassLoader.loadClass(ClassLoader.java:424)*
> > > * at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)*
> > > * at java.lang.ClassLoader.loadClass(ClassLoader.java:357)*
> > > * at
> > >
> > org.apache.calcite.avatica.ConnectionPropertiesImpl.<clinit>(ConnectionPropertiesImpl.java:38)*
> > > * at org.apache.calcite.avatica.MetaImpl.<init>(MetaImpl.java:72)*
> > > * at
> > > org.apache.calcite.jdbc.CalciteMetaImpl.<init>(CalciteMetaImpl.java:85)*
> > > * at org.apache.calcite.jdbc.Driver.createMeta(Driver.java:169)*
> > > * at
> > >
> > org.apache.calcite.avatica.AvaticaConnection.<init>(AvaticaConnection.java:121)*
> > > *        at
> > >
> > org.apache.calcite.jdbc.CalciteConnectionImpl.<init>(CalciteConnectionImpl.java:118)*
> > > * at
> > >
> > org.apache.calcite.jdbc.CalciteJdbc41Factory$CalciteJdbc41Connection.<init>(CalciteJdbc41Factory.java:115)*
> > > * at
> > >
> > org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:59)*
> > > * at
> > >
> > org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:1)*
> > > * at
> > >
> > org.apache.calcite.jdbc.CalciteFactory.newConnection(CalciteFactory.java:53)*
> > > * at
> > >
> > org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:138)*
> > > * at java.sql.DriverManager.getConnection(DriverManager.java:664)*
> > > * at java.sql.DriverManager.getConnection(DriverManager.java:208)*
> > > *        at
> > > org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:153)*
> > > * at org.apache.calcite.tools.RelBuilder.create(RelBuilder.java:209)*
> > >
> > > Is there any other alternate way I can use making this connection?
> > >
> > > Regards,
> > > Rakesh
> > >
> > > On Wed, Apr 17, 2019 at 12:59 PM Chunwei Lei <ch...@gmail.com>
> > wrote:
> > >
> > > > Hi, Rakesh
> > > >
> > > > I find that it says Protobuf doesn't provide source/binary
> > > > compatibility across different versions after searching the error
> > > > message using google[1].
> > > >
> > > > Maybe you can try to compile source code of Calcite which uses the
> > > > same version of Protobuf in Phoenix. But I am not sure that it can
> > > > work.
> > > >
> > > >
> > > > [1] https://groups.google.com/forum/#!topic/protobuf/N8rznIMcwWg
> > > >
> > > >
> > > > Bests,
> > > > Chunwei
> > > >
> > > > Rakesh Nair <19...@gmail.com> 于2019年4月17日周三 下午3:03写道:
> > > > >
> > > > > Hi,
> > > > > Could someone kindly help me with the problem I'm facing in my
> > previous
> > > > > email? I've been sitting on this for some time now and would really
> > like
> > > > to
> > > > > solve it.
> > > > > For what it's worth, these are the dependencies I'm using,
> > > > > *<dependencies>*
> > > > > * <!--
> > > > https://mvnrepository.com/artifact/org.apache.calcite/calcite-core
> > > > > <https://mvnrepository.com/artifact/org.apache.calcite/calcite-core>
> > > > -->*
> > > > > * <dependency>*
> > > > > * <groupId>org.apache.calcite</groupId>*
> > > > > * <artifactId>calcite-core</artifactId>*
> > > > > * <version>1.19.0</version>*
> > > > > * </dependency>*
> > > > > * <!--
> > > > https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core
> > > > > <https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core>
> > > > -->*
> > > > > * <dependency>*
> > > > > * <groupId>org.apache.phoenix</groupId>*
> > > > > * <artifactId>phoenix-core</artifactId>*
> > > > > * <version>5.0.0.3.0.1.0-187</version>*
> > > > > * </dependency>*
> > > > > * </dependencies>*
> > > > > * <repositories>*
> > > > > * <repository>*
> > > > > * <id>Hortonworks Repository</id>*
> > > > > * <url>http://repo.hortonworks.com/content/repositories/releases/
> > > > > <http://repo.hortonworks.com/content/repositories/releases/></url>*
> > > > > * </repository>*
> > > > > * </repositories>*
> > > > >
> > > > > Waiting for you response.
> > > > > Regards,
> > > > > Rakesh.
> > > > >
> > > > > On Tue, Apr 16, 2019 at 7:03 PM Rakesh Nair <
> > 1994hsekar1994@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hi,
> > > > > > So I've trying to connect Calcite with Apache Phoenix. Code given
> > > > below:
> > > > > >
> > > > > > *public Frameworks.ConfigBuilder configPhoenix() {*
> > > > > > * SchemaPlus rootSchema = Frameworks.createRootSchema(true);*
> > > > > >
> > > > > > * DataSource dataSource =
> > > > > > JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure",
> > > > > > "org.apache.phoenix.jdbc.PhoenixDriver", null, null);*
> > > > > > * JdbcSchema schema = JdbcSchema.create(rootSchema,
> > "hbase-unsecure",
> > > > > > dataSource, null, "hbase-unsecure");*
> > > > > > * for (String table : schema.getTableNames()) {*
> > > > > > * logger.info <http://logger.info>(table);*
> > > > > > * rootSchema.add(table, schema.getTable(table));*
> > > > > > * }*
> > > > > > * return Frameworks.newConfigBuilder().defaultSchema(rootSchema);*
> > > > > > * }*
> > > > > > *public static void main(String[] args) throws Exception {*
> > > > > > *FrameworkConfig config = configPhoenix().build();RelBuilder
> > builder =
> > > > > > RelBuilder.create(config);*
> > > > > > *}*
> > > > > >
> > > > > > Unfortunately I'm getting following error:
> > > > > >
> > > > > > *Exception in thread "main" java.lang.RuntimeException:
> > > > > > java.sql.SQLException: Cannot create PoolableConnectionFactory
> > > > > > (java.lang.VerifyError: class com.google.protobuf.LiteralByteString
> > > > > > overrides final method
> > > > toString.(Ljava/lang/String;)Ljava/lang/String;)*
> > > > > > * at
> > > > > >
> > > >
> > org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)*
> > > > > > * at
> > > > > >
> > > >
> > org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)*
> > > > > > * at
> > > > > >
> > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)*
> > > > > > * at
> > > > > >
> > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)*
> > > > > >
> > > > > > I presume this is happening because Protobuf 3+ jar is present in
> > > > > > classpath for use by Calcite while Phoenix actually requires
> > Protobuf
> > > > 2.5.0.
> > > > > >
> > > > > > So could someone tell me whether I'm doing something wrong here or
> > if
> > > > not,
> > > > > > then , how to handle this?
> > > > > >
> > > > > > Regards,
> > > > > > Rakesh
> > > > > >
> > > >
> >

Re: Connecting Calcite with Apache Phoenix

Posted by Rakesh Nair <19...@gmail.com>.
Hello Michael,
Would you mind elaborating a bit on how to accomplish this?

Regards,
Rakesh

On Wed, Apr 17, 2019 at 11:04 PM Michael Mior <mm...@apache.org> wrote:

> This dependency is due to files which were automatically generated
> with version 3 of the protobuf. You should hopefully be able to
> regenerate these files with version 2 to remove the dependency.
> --
> Michael Mior
> mmior@apache.org
>
> Le mer. 17 avr. 2019 à 03:56, Rakesh Nair <19...@gmail.com> a
> écrit :
> >
> > Hi Chunwei,
> > I do not believe that is gonna work because, to my understanding, Calcite
> > has internal dependency on *com/google/protobuf/GeneratedMessageV3 *which
> > is only available in Protobuf version 3+ onwards. Error trace:-
> >
> > *Exception in thread "main" java.lang.NoClassDefFoundError:
> > com/google/protobuf/GeneratedMessageV3*
> > * at java.lang.ClassLoader.defineClass1(Native Method)*
> > * at java.lang.ClassLoader.defineClass(ClassLoader.java:763)*
> > * at
> > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)*
> > * at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)*
> > * at java.net.URLClassLoader.access$100(URLClassLoader.java:73)*
> > * at java.net.URLClassLoader$1.run(URLClassLoader.java:368)*
> > * at java.net.URLClassLoader$1.run(URLClassLoader.java:362)*
> > * at java.security.AccessController.doPrivileged(Native Method)*
> > * at java.net.URLClassLoader.findClass(URLClassLoader.java:361)*
> > * at java.lang.ClassLoader.loadClass(ClassLoader.java:424)*
> > * at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)*
> > * at java.lang.ClassLoader.loadClass(ClassLoader.java:357)*
> > * at
> >
> org.apache.calcite.avatica.ConnectionPropertiesImpl.<clinit>(ConnectionPropertiesImpl.java:38)*
> > * at org.apache.calcite.avatica.MetaImpl.<init>(MetaImpl.java:72)*
> > * at
> > org.apache.calcite.jdbc.CalciteMetaImpl.<init>(CalciteMetaImpl.java:85)*
> > * at org.apache.calcite.jdbc.Driver.createMeta(Driver.java:169)*
> > * at
> >
> org.apache.calcite.avatica.AvaticaConnection.<init>(AvaticaConnection.java:121)*
> > *        at
> >
> org.apache.calcite.jdbc.CalciteConnectionImpl.<init>(CalciteConnectionImpl.java:118)*
> > * at
> >
> org.apache.calcite.jdbc.CalciteJdbc41Factory$CalciteJdbc41Connection.<init>(CalciteJdbc41Factory.java:115)*
> > * at
> >
> org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:59)*
> > * at
> >
> org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:1)*
> > * at
> >
> org.apache.calcite.jdbc.CalciteFactory.newConnection(CalciteFactory.java:53)*
> > * at
> >
> org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:138)*
> > * at java.sql.DriverManager.getConnection(DriverManager.java:664)*
> > * at java.sql.DriverManager.getConnection(DriverManager.java:208)*
> > *        at
> > org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:153)*
> > * at org.apache.calcite.tools.RelBuilder.create(RelBuilder.java:209)*
> >
> > Is there any other alternate way I can use making this connection?
> >
> > Regards,
> > Rakesh
> >
> > On Wed, Apr 17, 2019 at 12:59 PM Chunwei Lei <ch...@gmail.com>
> wrote:
> >
> > > Hi, Rakesh
> > >
> > > I find that it says Protobuf doesn't provide source/binary
> > > compatibility across different versions after searching the error
> > > message using google[1].
> > >
> > > Maybe you can try to compile source code of Calcite which uses the
> > > same version of Protobuf in Phoenix. But I am not sure that it can
> > > work.
> > >
> > >
> > > [1] https://groups.google.com/forum/#!topic/protobuf/N8rznIMcwWg
> > >
> > >
> > > Bests,
> > > Chunwei
> > >
> > > Rakesh Nair <19...@gmail.com> 于2019年4月17日周三 下午3:03写道:
> > > >
> > > > Hi,
> > > > Could someone kindly help me with the problem I'm facing in my
> previous
> > > > email? I've been sitting on this for some time now and would really
> like
> > > to
> > > > solve it.
> > > > For what it's worth, these are the dependencies I'm using,
> > > > *<dependencies>*
> > > > * <!--
> > > https://mvnrepository.com/artifact/org.apache.calcite/calcite-core
> > > > <https://mvnrepository.com/artifact/org.apache.calcite/calcite-core>
> > > -->*
> > > > * <dependency>*
> > > > * <groupId>org.apache.calcite</groupId>*
> > > > * <artifactId>calcite-core</artifactId>*
> > > > * <version>1.19.0</version>*
> > > > * </dependency>*
> > > > * <!--
> > > https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core
> > > > <https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core>
> > > -->*
> > > > * <dependency>*
> > > > * <groupId>org.apache.phoenix</groupId>*
> > > > * <artifactId>phoenix-core</artifactId>*
> > > > * <version>5.0.0.3.0.1.0-187</version>*
> > > > * </dependency>*
> > > > * </dependencies>*
> > > > * <repositories>*
> > > > * <repository>*
> > > > * <id>Hortonworks Repository</id>*
> > > > * <url>http://repo.hortonworks.com/content/repositories/releases/
> > > > <http://repo.hortonworks.com/content/repositories/releases/></url>*
> > > > * </repository>*
> > > > * </repositories>*
> > > >
> > > > Waiting for you response.
> > > > Regards,
> > > > Rakesh.
> > > >
> > > > On Tue, Apr 16, 2019 at 7:03 PM Rakesh Nair <
> 1994hsekar1994@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi,
> > > > > So I've trying to connect Calcite with Apache Phoenix. Code given
> > > below:
> > > > >
> > > > > *public Frameworks.ConfigBuilder configPhoenix() {*
> > > > > * SchemaPlus rootSchema = Frameworks.createRootSchema(true);*
> > > > >
> > > > > * DataSource dataSource =
> > > > > JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure",
> > > > > "org.apache.phoenix.jdbc.PhoenixDriver", null, null);*
> > > > > * JdbcSchema schema = JdbcSchema.create(rootSchema,
> "hbase-unsecure",
> > > > > dataSource, null, "hbase-unsecure");*
> > > > > * for (String table : schema.getTableNames()) {*
> > > > > * logger.info <http://logger.info>(table);*
> > > > > * rootSchema.add(table, schema.getTable(table));*
> > > > > * }*
> > > > > * return Frameworks.newConfigBuilder().defaultSchema(rootSchema);*
> > > > > * }*
> > > > > *public static void main(String[] args) throws Exception {*
> > > > > *FrameworkConfig config = configPhoenix().build();RelBuilder
> builder =
> > > > > RelBuilder.create(config);*
> > > > > *}*
> > > > >
> > > > > Unfortunately I'm getting following error:
> > > > >
> > > > > *Exception in thread "main" java.lang.RuntimeException:
> > > > > java.sql.SQLException: Cannot create PoolableConnectionFactory
> > > > > (java.lang.VerifyError: class com.google.protobuf.LiteralByteString
> > > > > overrides final method
> > > toString.(Ljava/lang/String;)Ljava/lang/String;)*
> > > > > * at
> > > > >
> > >
> org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)*
> > > > > * at
> > > > >
> > >
> org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)*
> > > > > * at
> > > > >
> org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)*
> > > > > * at
> > > > >
> org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)*
> > > > >
> > > > > I presume this is happening because Protobuf 3+ jar is present in
> > > > > classpath for use by Calcite while Phoenix actually requires
> Protobuf
> > > 2.5.0.
> > > > >
> > > > > So could someone tell me whether I'm doing something wrong here or
> if
> > > not,
> > > > > then , how to handle this?
> > > > >
> > > > > Regards,
> > > > > Rakesh
> > > > >
> > >
>

Re: Connecting Calcite with Apache Phoenix

Posted by Michael Mior <mm...@apache.org>.
This dependency is due to files which were automatically generated
with version 3 of the protobuf. You should hopefully be able to
regenerate these files with version 2 to remove the dependency.
--
Michael Mior
mmior@apache.org

Le mer. 17 avr. 2019 à 03:56, Rakesh Nair <19...@gmail.com> a écrit :
>
> Hi Chunwei,
> I do not believe that is gonna work because, to my understanding, Calcite
> has internal dependency on *com/google/protobuf/GeneratedMessageV3 *which
> is only available in Protobuf version 3+ onwards. Error trace:-
>
> *Exception in thread "main" java.lang.NoClassDefFoundError:
> com/google/protobuf/GeneratedMessageV3*
> * at java.lang.ClassLoader.defineClass1(Native Method)*
> * at java.lang.ClassLoader.defineClass(ClassLoader.java:763)*
> * at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)*
> * at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)*
> * at java.net.URLClassLoader.access$100(URLClassLoader.java:73)*
> * at java.net.URLClassLoader$1.run(URLClassLoader.java:368)*
> * at java.net.URLClassLoader$1.run(URLClassLoader.java:362)*
> * at java.security.AccessController.doPrivileged(Native Method)*
> * at java.net.URLClassLoader.findClass(URLClassLoader.java:361)*
> * at java.lang.ClassLoader.loadClass(ClassLoader.java:424)*
> * at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)*
> * at java.lang.ClassLoader.loadClass(ClassLoader.java:357)*
> * at
> org.apache.calcite.avatica.ConnectionPropertiesImpl.<clinit>(ConnectionPropertiesImpl.java:38)*
> * at org.apache.calcite.avatica.MetaImpl.<init>(MetaImpl.java:72)*
> * at
> org.apache.calcite.jdbc.CalciteMetaImpl.<init>(CalciteMetaImpl.java:85)*
> * at org.apache.calcite.jdbc.Driver.createMeta(Driver.java:169)*
> * at
> org.apache.calcite.avatica.AvaticaConnection.<init>(AvaticaConnection.java:121)*
> *        at
> org.apache.calcite.jdbc.CalciteConnectionImpl.<init>(CalciteConnectionImpl.java:118)*
> * at
> org.apache.calcite.jdbc.CalciteJdbc41Factory$CalciteJdbc41Connection.<init>(CalciteJdbc41Factory.java:115)*
> * at
> org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:59)*
> * at
> org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:1)*
> * at
> org.apache.calcite.jdbc.CalciteFactory.newConnection(CalciteFactory.java:53)*
> * at
> org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:138)*
> * at java.sql.DriverManager.getConnection(DriverManager.java:664)*
> * at java.sql.DriverManager.getConnection(DriverManager.java:208)*
> *        at
> org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:153)*
> * at org.apache.calcite.tools.RelBuilder.create(RelBuilder.java:209)*
>
> Is there any other alternate way I can use making this connection?
>
> Regards,
> Rakesh
>
> On Wed, Apr 17, 2019 at 12:59 PM Chunwei Lei <ch...@gmail.com> wrote:
>
> > Hi, Rakesh
> >
> > I find that it says Protobuf doesn't provide source/binary
> > compatibility across different versions after searching the error
> > message using google[1].
> >
> > Maybe you can try to compile source code of Calcite which uses the
> > same version of Protobuf in Phoenix. But I am not sure that it can
> > work.
> >
> >
> > [1] https://groups.google.com/forum/#!topic/protobuf/N8rznIMcwWg
> >
> >
> > Bests,
> > Chunwei
> >
> > Rakesh Nair <19...@gmail.com> 于2019年4月17日周三 下午3:03写道:
> > >
> > > Hi,
> > > Could someone kindly help me with the problem I'm facing in my previous
> > > email? I've been sitting on this for some time now and would really like
> > to
> > > solve it.
> > > For what it's worth, these are the dependencies I'm using,
> > > *<dependencies>*
> > > * <!--
> > https://mvnrepository.com/artifact/org.apache.calcite/calcite-core
> > > <https://mvnrepository.com/artifact/org.apache.calcite/calcite-core>
> > -->*
> > > * <dependency>*
> > > * <groupId>org.apache.calcite</groupId>*
> > > * <artifactId>calcite-core</artifactId>*
> > > * <version>1.19.0</version>*
> > > * </dependency>*
> > > * <!--
> > https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core
> > > <https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core>
> > -->*
> > > * <dependency>*
> > > * <groupId>org.apache.phoenix</groupId>*
> > > * <artifactId>phoenix-core</artifactId>*
> > > * <version>5.0.0.3.0.1.0-187</version>*
> > > * </dependency>*
> > > * </dependencies>*
> > > * <repositories>*
> > > * <repository>*
> > > * <id>Hortonworks Repository</id>*
> > > * <url>http://repo.hortonworks.com/content/repositories/releases/
> > > <http://repo.hortonworks.com/content/repositories/releases/></url>*
> > > * </repository>*
> > > * </repositories>*
> > >
> > > Waiting for you response.
> > > Regards,
> > > Rakesh.
> > >
> > > On Tue, Apr 16, 2019 at 7:03 PM Rakesh Nair <19...@gmail.com>
> > > wrote:
> > >
> > > > Hi,
> > > > So I've trying to connect Calcite with Apache Phoenix. Code given
> > below:
> > > >
> > > > *public Frameworks.ConfigBuilder configPhoenix() {*
> > > > * SchemaPlus rootSchema = Frameworks.createRootSchema(true);*
> > > >
> > > > * DataSource dataSource =
> > > > JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure",
> > > > "org.apache.phoenix.jdbc.PhoenixDriver", null, null);*
> > > > * JdbcSchema schema = JdbcSchema.create(rootSchema, "hbase-unsecure",
> > > > dataSource, null, "hbase-unsecure");*
> > > > * for (String table : schema.getTableNames()) {*
> > > > * logger.info <http://logger.info>(table);*
> > > > * rootSchema.add(table, schema.getTable(table));*
> > > > * }*
> > > > * return Frameworks.newConfigBuilder().defaultSchema(rootSchema);*
> > > > * }*
> > > > *public static void main(String[] args) throws Exception {*
> > > > *FrameworkConfig config = configPhoenix().build();RelBuilder builder =
> > > > RelBuilder.create(config);*
> > > > *}*
> > > >
> > > > Unfortunately I'm getting following error:
> > > >
> > > > *Exception in thread "main" java.lang.RuntimeException:
> > > > java.sql.SQLException: Cannot create PoolableConnectionFactory
> > > > (java.lang.VerifyError: class com.google.protobuf.LiteralByteString
> > > > overrides final method
> > toString.(Ljava/lang/String;)Ljava/lang/String;)*
> > > > * at
> > > >
> > org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)*
> > > > * at
> > > >
> > org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)*
> > > > * at
> > > > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)*
> > > > * at
> > > > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)*
> > > >
> > > > I presume this is happening because Protobuf 3+ jar is present in
> > > > classpath for use by Calcite while Phoenix actually requires Protobuf
> > 2.5.0.
> > > >
> > > > So could someone tell me whether I'm doing something wrong here or if
> > not,
> > > > then , how to handle this?
> > > >
> > > > Regards,
> > > > Rakesh
> > > >
> >

Re: Connecting Calcite with Apache Phoenix

Posted by Rakesh Nair <19...@gmail.com>.
Hi Chunwei,
I do not believe that is gonna work because, to my understanding, Calcite
has internal dependency on *com/google/protobuf/GeneratedMessageV3 *which
is only available in Protobuf version 3+ onwards. Error trace:-

*Exception in thread "main" java.lang.NoClassDefFoundError:
com/google/protobuf/GeneratedMessageV3*
* at java.lang.ClassLoader.defineClass1(Native Method)*
* at java.lang.ClassLoader.defineClass(ClassLoader.java:763)*
* at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)*
* at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)*
* at java.net.URLClassLoader.access$100(URLClassLoader.java:73)*
* at java.net.URLClassLoader$1.run(URLClassLoader.java:368)*
* at java.net.URLClassLoader$1.run(URLClassLoader.java:362)*
* at java.security.AccessController.doPrivileged(Native Method)*
* at java.net.URLClassLoader.findClass(URLClassLoader.java:361)*
* at java.lang.ClassLoader.loadClass(ClassLoader.java:424)*
* at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)*
* at java.lang.ClassLoader.loadClass(ClassLoader.java:357)*
* at
org.apache.calcite.avatica.ConnectionPropertiesImpl.<clinit>(ConnectionPropertiesImpl.java:38)*
* at org.apache.calcite.avatica.MetaImpl.<init>(MetaImpl.java:72)*
* at
org.apache.calcite.jdbc.CalciteMetaImpl.<init>(CalciteMetaImpl.java:85)*
* at org.apache.calcite.jdbc.Driver.createMeta(Driver.java:169)*
* at
org.apache.calcite.avatica.AvaticaConnection.<init>(AvaticaConnection.java:121)*
*        at
org.apache.calcite.jdbc.CalciteConnectionImpl.<init>(CalciteConnectionImpl.java:118)*
* at
org.apache.calcite.jdbc.CalciteJdbc41Factory$CalciteJdbc41Connection.<init>(CalciteJdbc41Factory.java:115)*
* at
org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:59)*
* at
org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:1)*
* at
org.apache.calcite.jdbc.CalciteFactory.newConnection(CalciteFactory.java:53)*
* at
org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:138)*
* at java.sql.DriverManager.getConnection(DriverManager.java:664)*
* at java.sql.DriverManager.getConnection(DriverManager.java:208)*
*        at
org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:153)*
* at org.apache.calcite.tools.RelBuilder.create(RelBuilder.java:209)*

Is there any other alternate way I can use making this connection?

Regards,
Rakesh

On Wed, Apr 17, 2019 at 12:59 PM Chunwei Lei <ch...@gmail.com> wrote:

> Hi, Rakesh
>
> I find that it says Protobuf doesn't provide source/binary
> compatibility across different versions after searching the error
> message using google[1].
>
> Maybe you can try to compile source code of Calcite which uses the
> same version of Protobuf in Phoenix. But I am not sure that it can
> work.
>
>
> [1] https://groups.google.com/forum/#!topic/protobuf/N8rznIMcwWg
>
>
> Bests,
> Chunwei
>
> Rakesh Nair <19...@gmail.com> 于2019年4月17日周三 下午3:03写道:
> >
> > Hi,
> > Could someone kindly help me with the problem I'm facing in my previous
> > email? I've been sitting on this for some time now and would really like
> to
> > solve it.
> > For what it's worth, these are the dependencies I'm using,
> > *<dependencies>*
> > * <!--
> https://mvnrepository.com/artifact/org.apache.calcite/calcite-core
> > <https://mvnrepository.com/artifact/org.apache.calcite/calcite-core>
> -->*
> > * <dependency>*
> > * <groupId>org.apache.calcite</groupId>*
> > * <artifactId>calcite-core</artifactId>*
> > * <version>1.19.0</version>*
> > * </dependency>*
> > * <!--
> https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core
> > <https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core>
> -->*
> > * <dependency>*
> > * <groupId>org.apache.phoenix</groupId>*
> > * <artifactId>phoenix-core</artifactId>*
> > * <version>5.0.0.3.0.1.0-187</version>*
> > * </dependency>*
> > * </dependencies>*
> > * <repositories>*
> > * <repository>*
> > * <id>Hortonworks Repository</id>*
> > * <url>http://repo.hortonworks.com/content/repositories/releases/
> > <http://repo.hortonworks.com/content/repositories/releases/></url>*
> > * </repository>*
> > * </repositories>*
> >
> > Waiting for you response.
> > Regards,
> > Rakesh.
> >
> > On Tue, Apr 16, 2019 at 7:03 PM Rakesh Nair <19...@gmail.com>
> > wrote:
> >
> > > Hi,
> > > So I've trying to connect Calcite with Apache Phoenix. Code given
> below:
> > >
> > > *public Frameworks.ConfigBuilder configPhoenix() {*
> > > * SchemaPlus rootSchema = Frameworks.createRootSchema(true);*
> > >
> > > * DataSource dataSource =
> > > JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure",
> > > "org.apache.phoenix.jdbc.PhoenixDriver", null, null);*
> > > * JdbcSchema schema = JdbcSchema.create(rootSchema, "hbase-unsecure",
> > > dataSource, null, "hbase-unsecure");*
> > > * for (String table : schema.getTableNames()) {*
> > > * logger.info <http://logger.info>(table);*
> > > * rootSchema.add(table, schema.getTable(table));*
> > > * }*
> > > * return Frameworks.newConfigBuilder().defaultSchema(rootSchema);*
> > > * }*
> > > *public static void main(String[] args) throws Exception {*
> > > *FrameworkConfig config = configPhoenix().build();RelBuilder builder =
> > > RelBuilder.create(config);*
> > > *}*
> > >
> > > Unfortunately I'm getting following error:
> > >
> > > *Exception in thread "main" java.lang.RuntimeException:
> > > java.sql.SQLException: Cannot create PoolableConnectionFactory
> > > (java.lang.VerifyError: class com.google.protobuf.LiteralByteString
> > > overrides final method
> toString.(Ljava/lang/String;)Ljava/lang/String;)*
> > > * at
> > >
> org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)*
> > > * at
> > >
> org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)*
> > > * at
> > > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)*
> > > * at
> > > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)*
> > >
> > > I presume this is happening because Protobuf 3+ jar is present in
> > > classpath for use by Calcite while Phoenix actually requires Protobuf
> 2.5.0.
> > >
> > > So could someone tell me whether I'm doing something wrong here or if
> not,
> > > then , how to handle this?
> > >
> > > Regards,
> > > Rakesh
> > >
>

Re: Connecting Calcite with Apache Phoenix

Posted by Chunwei Lei <ch...@gmail.com>.
Hi, Rakesh

I find that it says Protobuf doesn't provide source/binary
compatibility across different versions after searching the error
message using google[1].

Maybe you can try to compile source code of Calcite which uses the
same version of Protobuf in Phoenix. But I am not sure that it can
work.


[1] https://groups.google.com/forum/#!topic/protobuf/N8rznIMcwWg


Bests,
Chunwei

Rakesh Nair <19...@gmail.com> 于2019年4月17日周三 下午3:03写道:
>
> Hi,
> Could someone kindly help me with the problem I'm facing in my previous
> email? I've been sitting on this for some time now and would really like to
> solve it.
> For what it's worth, these are the dependencies I'm using,
> *<dependencies>*
> * <!-- https://mvnrepository.com/artifact/org.apache.calcite/calcite-core
> <https://mvnrepository.com/artifact/org.apache.calcite/calcite-core> -->*
> * <dependency>*
> * <groupId>org.apache.calcite</groupId>*
> * <artifactId>calcite-core</artifactId>*
> * <version>1.19.0</version>*
> * </dependency>*
> * <!-- https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core
> <https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core> -->*
> * <dependency>*
> * <groupId>org.apache.phoenix</groupId>*
> * <artifactId>phoenix-core</artifactId>*
> * <version>5.0.0.3.0.1.0-187</version>*
> * </dependency>*
> * </dependencies>*
> * <repositories>*
> * <repository>*
> * <id>Hortonworks Repository</id>*
> * <url>http://repo.hortonworks.com/content/repositories/releases/
> <http://repo.hortonworks.com/content/repositories/releases/></url>*
> * </repository>*
> * </repositories>*
>
> Waiting for you response.
> Regards,
> Rakesh.
>
> On Tue, Apr 16, 2019 at 7:03 PM Rakesh Nair <19...@gmail.com>
> wrote:
>
> > Hi,
> > So I've trying to connect Calcite with Apache Phoenix. Code given below:
> >
> > *public Frameworks.ConfigBuilder configPhoenix() {*
> > * SchemaPlus rootSchema = Frameworks.createRootSchema(true);*
> >
> > * DataSource dataSource =
> > JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure",
> > "org.apache.phoenix.jdbc.PhoenixDriver", null, null);*
> > * JdbcSchema schema = JdbcSchema.create(rootSchema, "hbase-unsecure",
> > dataSource, null, "hbase-unsecure");*
> > * for (String table : schema.getTableNames()) {*
> > * logger.info <http://logger.info>(table);*
> > * rootSchema.add(table, schema.getTable(table));*
> > * }*
> > * return Frameworks.newConfigBuilder().defaultSchema(rootSchema);*
> > * }*
> > *public static void main(String[] args) throws Exception {*
> > *FrameworkConfig config = configPhoenix().build();RelBuilder builder =
> > RelBuilder.create(config);*
> > *}*
> >
> > Unfortunately I'm getting following error:
> >
> > *Exception in thread "main" java.lang.RuntimeException:
> > java.sql.SQLException: Cannot create PoolableConnectionFactory
> > (java.lang.VerifyError: class com.google.protobuf.LiteralByteString
> > overrides final method toString.(Ljava/lang/String;)Ljava/lang/String;)*
> > * at
> > org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)*
> > * at
> > org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)*
> > * at
> > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)*
> > * at
> > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)*
> >
> > I presume this is happening because Protobuf 3+ jar is present in
> > classpath for use by Calcite while Phoenix actually requires Protobuf 2.5.0.
> >
> > So could someone tell me whether I'm doing something wrong here or if not,
> > then , how to handle this?
> >
> > Regards,
> > Rakesh
> >

Re: Connecting Calcite with Apache Phoenix

Posted by Rakesh Nair <19...@gmail.com>.
Hi,
Could someone kindly help me with the problem I'm facing in my previous
email? I've been sitting on this for some time now and would really like to
solve it.
For what it's worth, these are the dependencies I'm using,
*<dependencies>*
* <!-- https://mvnrepository.com/artifact/org.apache.calcite/calcite-core
<https://mvnrepository.com/artifact/org.apache.calcite/calcite-core> -->*
* <dependency>*
* <groupId>org.apache.calcite</groupId>*
* <artifactId>calcite-core</artifactId>*
* <version>1.19.0</version>*
* </dependency>*
* <!-- https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core
<https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core> -->*
* <dependency>*
* <groupId>org.apache.phoenix</groupId>*
* <artifactId>phoenix-core</artifactId>*
* <version>5.0.0.3.0.1.0-187</version>*
* </dependency>*
* </dependencies>*
* <repositories>*
* <repository>*
* <id>Hortonworks Repository</id>*
* <url>http://repo.hortonworks.com/content/repositories/releases/
<http://repo.hortonworks.com/content/repositories/releases/></url>*
* </repository>*
* </repositories>*

Waiting for you response.
Regards,
Rakesh.

On Tue, Apr 16, 2019 at 7:03 PM Rakesh Nair <19...@gmail.com>
wrote:

> Hi,
> So I've trying to connect Calcite with Apache Phoenix. Code given below:
>
> *public Frameworks.ConfigBuilder configPhoenix() {*
> * SchemaPlus rootSchema = Frameworks.createRootSchema(true);*
>
> * DataSource dataSource =
> JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure",
> "org.apache.phoenix.jdbc.PhoenixDriver", null, null);*
> * JdbcSchema schema = JdbcSchema.create(rootSchema, "hbase-unsecure",
> dataSource, null, "hbase-unsecure");*
> * for (String table : schema.getTableNames()) {*
> * logger.info <http://logger.info>(table);*
> * rootSchema.add(table, schema.getTable(table));*
> * }*
> * return Frameworks.newConfigBuilder().defaultSchema(rootSchema);*
> * }*
> *public static void main(String[] args) throws Exception {*
> *FrameworkConfig config = configPhoenix().build();RelBuilder builder =
> RelBuilder.create(config);*
> *}*
>
> Unfortunately I'm getting following error:
>
> *Exception in thread "main" java.lang.RuntimeException:
> java.sql.SQLException: Cannot create PoolableConnectionFactory
> (java.lang.VerifyError: class com.google.protobuf.LiteralByteString
> overrides final method toString.(Ljava/lang/String;)Ljava/lang/String;)*
> * at
> org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)*
> * at
> org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)*
> * at
> org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)*
> * at
> org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)*
>
> I presume this is happening because Protobuf 3+ jar is present in
> classpath for use by Calcite while Phoenix actually requires Protobuf 2.5.0.
>
> So could someone tell me whether I'm doing something wrong here or if not,
> then , how to handle this?
>
> Regards,
> Rakesh
>