Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-4017

Can't close long running hive Query Statements

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.0
    • Fix Version/s: None
    • Component/s: JDBC
    • Labels:
    • Environment:

      Ubuntu 11.04

      Description

      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.

        Issue Links

          Activity

          Hide
          nidhin2107 K S Nidhin added a comment -

          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); }

          }
          }

          Show
          nidhin2107 K S Nidhin added a comment - 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); } } }

            People

            • Assignee:
              Unassigned
              Reporter:
              abimaran Kugathasan Abimaran
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development