Reply
New Contributor
Posts: 7
Registered: ‎04-26-2018

Hive JDBC Timestamp issue

[ Edited ]

When attempting to set a Timestamp parameter on a PreparedStatement I receive an error. What is the problem here?

 

ps.setTimestamp(index, new Timestamp(System.currentTimeMillis()));

 

I recieve an error:

 

org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 1:182 mismatched input '-' expecting ) near '2018' in statement
	at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:241)
	at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:227)
	at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:255)
	at org.apache.hive.jdbc.HiveStatement.executeUpdate(HiveStatement.java:407)
	at org.apache.hive.jdbc.HivePreparedStatement.executeUpdate(HivePreparedStatement.java:121)
	at uk.co.rbs.digital.hr.service.DataTransferJobExecutionService.executeJob(DataTransferJobExecutionService.java:92)
	at uk.co.rbs.digital.hr.Runner.run(Runner.java:30)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:797)
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:781)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
	at uk.co.rbs.digital.hr.Runner.main(Runner.java:22)
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 1:182 mismatched input '-' expecting ) near '2018' in statement
	at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:400)
	at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:187)
	at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:271)
	at org.apache.hive.service.cli.operation.Operation.run(Operation.java:337)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:439)
	at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:416)
	at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:282)
	at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:501)
	at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313)
	at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)
	at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
	at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
	at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge$Server$TUGIAssumingProcessor.process(HadoopThriftAuthBridge.java:746)
	at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.parse.ParseException:line 1:182 mismatched input '-' expecting ) near '2018' in statement
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:204)
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:522)
	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1356)
	at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1343)
	at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:185)
	... 15 more

Table format is Parquet.

 

The driver version is:

 

<dependency>
   <groupId>org.apache.hive</groupId>
   <artifactId>hive-jdbc</artifactId>
   <version>1.1.0-cdh5.12.1</version>
</dependency>

 

Highlighted
New Contributor
Posts: 7
Registered: ‎04-26-2018

Re: Hive JDBC Timestamp issue

[ Edited ]

Related bug report. Only fixed in V2 unfortunately and not backported.

 

https://issues.apache.org/jira/browse/HIVE-11748?jql=project%20%3D%20HIVE%20AND%20text%20~%20%22jdbc...

 

 

Announcements