If you get the following error when running Impala query through Impala JDBC Driver:

com.cloudera.sqlengine.exceptions.SQLEngineException: [Simba][JSQLEngine](11000) 
Syntax error near character 3: use<<< ??? >>> database_name
at com.cloudera.sqlengine.parser.PTParseErrorInfo.makeSyntaxError(Unknown Source)
at com.cloudera.sqlengine.parser.generated.Parser.yyerror(Unknown Source)
at com.cloudera.sqlengine.parser.generated.Parser.yyparse(Unknown Source)
at com.cloudera.sqlengine.parser.generated.Parser.parse(Unknown Source)
at com.cloudera.sqlengine.parser.PTParser.parse(Unknown Source)
at com.cloudera.sqlengine.dsiext.dataengine.SqlDataEngine.prepare(Unknown Source)
at com.cloudera.hivecommon.dataengine.HiveJDBCDataEngine.prepare(Unknown Source)
at com.cloudera.jdbc.common.SStatement.executeNoParams(Unknown Source)
at com.cloudera.jdbc.common.SStatement.execute(Unknown Source)
at com.jpmc.risk.mspdb.GenerateHQL1.compareSumEbcdicResult(GenerateHQL1.java:870)
at com.jpmc.risk.mspdb.MSPDriver.execute(MSPDriver.java:366)
at com.jpmc.risk.mspdb.MSPDriver.main(MSPDriver.java:43)

com.cloudera.hivecommon.dataengine.HiveJDBCDataEngine.prepare: [Simba][JSQLEngine](11000) 
Syntax error near character 36: SELECT * FROM table_name LIMIT<<< ??? >>> 1
com.cloudera.sqlengine.exceptions.SQLEngineException: [Simba][JSQLEngine](11000) 
Syntax error near character 36: SELECT * FROM table_name LIMIT<<< ??? >>> 1
at com.cloudera.sqlengine.parser.PTParseErrorInfo.makeSyntaxError(Unknown Source)
at com.cloudera.sqlengine.parser.generated.Parser.yyerror(Unknown Source)
at com.cloudera.sqlengine.parser.generated.Parser.yyparse(Unknown Source)
at com.cloudera.sqlengine.parser.generated.Parser.parse(Unknown Source)
at com.cloudera.sqlengine.parser.PTParser.parse(Unknown Source)
at com.cloudera.sqlengine.dsiext.dataengine.SqlDataEngine.prepare(Unknown Source)
at com.cloudera.hivecommon.dataengine.HiveJDBCDataEngine.prepare(Unknown Source)
at com.cloudera.jdbc.common.SStatement.executeNoParams(Unknown Source)
at com.cloudera.jdbc.common.SStatement.executeQuery(Unknown Source)
at com.jpmc.risk.mspdb.GenerateHQL1.insExepRecords(GenerateHQL1.java:316)
at com.jpmc.risk.mspdb.MSPDriver.execute(MSPDriver.java:398)
at com.jpmc.risk.mspdb.MSPDriver.main(MSPDriver.java:43)

it is caused by Impala Driver tried to transform queries that were already in the Impala native form, and caused syntax error.

The solution here is to add UseNativeQuery=1 in the JDBC query string parameter, for example:

jdbc:impala://localhost:21050;AuthMech=3;UID=UserName;PWD=Password&useNativeQuery=1

So that the query will not be transformed and remain as what ever the original query was, this should help with the error.

Leave a Reply

Your email address will not be published. Required fields are marked *