[ https://issues.apache.org/jira/browse/HIVE-4017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13906900#comment-13906900 ]
K S Nidhin commented on HIVE-4017: ---------------------------------- The following code shows a work around to kill a particular hive query . A If condition can also be used along with this for checking the elasped time for further filteration before killing the job. Job name in case of hive is same as the hive query , so comparing the job name and the query we passed , we can pin down the job id of the running job and kill it programitically. Configuration conf = new Configuration(); String query = "select * from default.account limit 15"; String jobTrackerHost = "ibm-r1-node2.apache-nextgen.com"; int jobTrackerPort = 8021; InetSocketAddress jobtracker = new InetSocketAddress(jobTrackerHost, jobTrackerPort); JobClient jobClient = new JobClient(jobtracker, conf); jobClient.setConf(conf); JobStatus[] jobs = jobClient.jobsToComplete(); for (int i = 0; i < jobs.length; i++) { JobStatus js = jobs[i]; if (js.getRunState() == JobStatus.RUNNING) { JobID jobId = js.getJobID(); String jobName = jobClient.getJob(jobId).getJobName(); if (jobName.equalsIgnoreCase(query)) { JobConf jc = new JobConf(conf); JobTracker jt = JobTracker.startTracker(jc); jt.killJob(jobId); } } } > Can't close long running hive Query Statements > ---------------------------------------------- > > Key: HIVE-4017 > URL: https://issues.apache.org/jira/browse/HIVE-4017 > Project: Hive > Issue Type: Bug > Components: JDBC > Affects Versions: 0.9.0 > Environment: Ubuntu 11.04 > Reporter: Kugathasan Abimaran > Labels: features > > Currently, we can't set the hive query timeout period. Hive returns "Method > not supported". Are there anyways to stop the long running hive query > statements. -- This message was sent by Atlassian JIRA (v6.1.5#6160)