Max Luwang
Max Luwang

Reputation: 79

hive count query not able to complete it run forever

I am new with Hive and I am using HBASE-1.1.0 ,Hadoop-2.5.1 and Hive-0.13 for my requirement.

The set up is fine absolutely and I am able to run hive query using beeline.

Query : Select count(*) from X_Table.

The query completed with 37.848 second.

The same environment I have setup with Maven project and tried to execute some select query using Hive Client its work well. But when I try to execute the same count query the Mapreduce job not able to complete. Its look like restarting the job again. How can I solve this issue?

Code

Connection con = DriverManager.getConnection("jdbc:hive2://abc:10000/default","", "");
    Statement stmt = con.createStatement();               
    String query = "select count(*) from X_Table                                    
    ResultSet res = stmt.executeQuery(query);       
    while (res.next()) {
        //code here
    }

Log Details:

Total jobs = 1 
Launching Job 1 out of 1
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):  
    set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:  
    set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
    set mapreduce.job.reduces=<number>
Starting Job = job_1429243611915_0030, Tracking URL = http://master:8088/proxy/application_1429243611915_0030/
Kill Command = /usr/local/pcs/hadoop/bin/hadoop job  -kill job_1429243611915_0030
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2015-04-20 09:28:02,616 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:29:02,728 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:30:03,432 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:31:04,054 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:32:04,675 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:33:05,298 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:34:05,866 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:35:06,419 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:36:06,985 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:37:07,551 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:38:08,289 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:39:09,184 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:40:09,780 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:41:10,367 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:42:10,965 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:43:11,595 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:44:12,181 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:45:12,952 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:46:13,590 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:47:14,218 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:48:14,790 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:49:15,378 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:50:16,014 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:51:16,808 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:52:17,378 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:53:17,928 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:54:18,491 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:55:19,049 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:56:19,797 Stage-1 map = 0%,  reduce = 0%
2015-04-20 09:57:20,344 Stage-1 map = 0%,  reduce = 0%
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):
    set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
    set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
    set mapreduce.job.reduces=<number>
Starting Job = job_1429243611915_0031, Tracking URL = http://master:8088/proxy/application_1429243611915_0031/
Kill Command = /usr/local/pcs/hadoop/bin/hadoop job  -kill job_1429243611915_0031
2015-04-20 09:58:20,858 Stage-1 map = 0%,  reduce = 0%

Upvotes: 2

Views: 1639

Answers (2)

HarishK
HarishK

Reputation: 1

The above answer works adn it really helped me a lot. I was trying to run a simple count(*) query in HIVE but then it would neither error out nor complete. It will hang in there until I kill the job in command prompt. I was totally mad and I was not getting appropriate answers from google. But the above answer helped me a lot. so we need to increase the memory of

  • yarn.scheduler.maximum-allocation-mb
  • yarn.nodemanager.resource.memory-mb

This could be done in Yarn-Site.xml or even in Cloudera Manager under Yarn Service. Once you increase the memory restart all the stale services. This will resolve the issues.

Upvotes: 0

Chennakrishna
Chennakrishna

Reputation: 181

If you increase memory for these two configuration in the yarn-site.xml file, then it will run fast.

yarn.scheduler.maximum-allocation-mb yarn.nodemanager.resource.memory-mb

Upvotes: 1

Related Questions