Questions:
Spark integrated Hive, when starting Spark-shell or Spark-sql, error:
noton mysql: atline15. "@" (64after"".
Environment:
spark-1.4
hive-1.2.1
mysql-5.1
JDBC Driver
Reason:
See how Hive's Source Metastoredirectsql is constructed:
publicMetaStoreDirectSql(PersistenceManager pm) { this.pm = pm; Transaction tx = pm.currentTransaction(); tx.begin(); booleanfalse; try { trySetAnsiQuotesForMysql(); true; catch (SQLException sqlEx) { LOG.info("MySQL check failed, assuming we are not on mysql: " + sqlEx.getMessage()); tx.rollback(); tx = pm.currentTransaction(); tx.begin(); }
where Metastoredirectsql.trysetansiquotesformysql () is called, the code sets Sql_mode:
SET @@session.sql_mode=ANSI_QUOTES
When MySQL's JDBC driver executes execute (SQL), it first checks the statement and then reports encountered: "@" (64) is wrong.
Solution:
(No good solution has been found yet)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Spark integrated hive encounters MySQL check failure