I was trying to access spark sql through jdbc but facing some error. I am trying to run beeline
! /usr/lib/spark/bin/beeline -u 'jdbc:hive2://host:10016/default;transportMode=binary' -e '' 2>&1| awk '{print}'|grep -i -e 'Connection refused' -e 'Invalid URL' -e 'Error: Could not open'
host
value is correct in command.(deliberately written for making it generic)
Error: Could not open client transport with JDBC Uri: host:10016/default;transportMode=binary: java.net.ConnectException: Connection refused (Connection refused) (state=08S01,code=0)
hive.server2.thrift.port=10016 and mode is binary.
I verified the process is running on this port.
I checked the spark thrift server logs:
link to logs : https://pastebin.com/G5Mwaw7E
It says
java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
(pasted the logs in above link).
I am using spark version 3.1.0 , hive 3.1.2 and hadoop 3.1.2. Following this guide https://spark.apache.org/docs/latest/sql-data-sources-hive-tables.html#interacting-with-different-versions-of-hive-metastore
I set "spark.sql.hive.metastore.version" to 3.1.2 and set jars to point to hivemetastore 3.1.2 jars but still getting the same error.
From logs I also got suspicious about a mismatch in the version of datanucleus core in hive and spark but both use the same version.
https://github.com/apache/hive/blob/branch-3.1/pom.xml#L129
https://github.com/apache/spark/blob/branch-3.1/pom.xml#L184 (edited)
21/05/14 13:42:44 INFO Persistence: Property spark.hadoop.javax.jdo.option.ConnectionDriverName unknown - will be ignored
21/05/14 13:42:44 INFO Persistence: Property spark.hadoop.javax.jdo.option.ConnectionURL unknown - will be ignored
21/05/14 13:42:44 INFO Persistence: Property spark.hadoop.javax.jdo.option.ConnectionUserName unknown - will be ignored
21/05/14 13:42:44 INFO Persistence: Property hive.metastore.integral.jdo.pushdown unknown - will be ignored
21/05/14 13:42:44 INFO Persistence: Property spark.hadoop.javax.jdo.option.ConnectionPassword unknown - will be ignored
21/05/14 13:42:44 INFO Persistence: Property datanucleus.cache.level2 unknown - will be ignored
21/05/14 13:42:45 WARN Datastore: Error initialising derby schema : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NAME 'org.datanucleus.store.rdbms.adapter.DerbySQLFunction.ascii' CALLED ON NULL' at line 1
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NAME 'org.datanucleus.store.rdbms.adapter.DerbySQLFunction.ascii' CALLED ON NULL' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
^ this looks suspecious too, metastore is mysql
Is this a known issue , how should this be fixed. Let me know if anything else is required.
Thanks