Hive——级联求和accumulate

Hive级联求和技术要点总结 级联求和在Hive中的实现通常依赖于窗口函数(Window Functions),尤其是SUM()函数结合OVER()子句。通过这种方式,我们可以对指定范围内的数据进行分组累加,从而得到每一行对应的累计和。级联求和是一个在数据分析领域常用的术语,用于描述一种按照特定顺序连续求和的过程。它允许分析师按照数据的层级关系进行汇总,从而得到符合业务逻辑的有意义的汇总数据。窗口函数是SQL中用于执行聚合操作但返回和输入行数相同数量行的函数。 阅读详情
  > create table t_access_times(username string,month string,salary int)
    > row format delimited fields terminated by ',';
OK
Time taken: 0.812 seconds
hive> select  * from  t_access_times ;
OK
Time taken: 0.468 seconds
hive> load data local inpath "/home/wangshumin/hive/t_access_times.data" into table t_access_times;
Loading data to table default.t_access_times
Table default.t_access_times stats: [numFiles=1, totalSize=123]
OK
Time taken: 0.706 seconds
hive> select  * from  t_access_times ;
OK
A 2015-01 5
A 2015-01 15
B 2015-01 5
A 2015-01 8
B 2015-01 25
A 2015-01 5
A 2015-02 4
A 2015-02 6
B 2015-02 10
B 2015-02 5
Time taken: 0.073 seconds, Fetched: 10 row(s)
hive> desc t_access_times;
OK
username             string                                  
month               string                                  
salary               int                                    
Time taken: 0.083 seconds, Fetched: 3 row(s)
hive> select username , month  from t_access_times groupby username;
FAILED: ParseException line 1:53 extraneous input 'username' expecting EOF near '<EOF>'
hive> select username , month ,sum(salary) as  salary from t_access_times groupby username;
FAILED: ParseException line 1:76 extraneous input 'username' expecting EOF near '<EOF>'
hive> select username , month ,sum(salary) as  salary from t_access_times group by username;
FAILED: SemanticException Line 0:-1 Expression not in GROUP BY key 'month'
hive> select username , month ,sum(salary) as  salary from t_access_times group by username,month;
Query ID = wangshumin_20180320235349_b8ac6339-2637-4efd-be6f-3cab2fd60675
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0020, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0020/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0020
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2018-03-20 23:53:59,728 Stage-1 map = 0%,  reduce = 0%
2018-03-20 23:54:19,852 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.39 sec
2018-03-20 23:54:33,628 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 3.55 sec
MapReduce Total cumulative CPU time: 3 seconds 550 msec
Ended Job = job_1521538874183_0020
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 3.55 sec   HDFS Read: 7708 HDFS Write: 52 SUCCESS
Total MapReduce CPU Time Spent: 3 seconds 550 msec
OK
A 2015-01 33
A 2015-02 10
B 2015-01 30
B 2015-02 15
Time taken: 45.435 seconds, Fetched: 4 row(s)
hive> select username ,sum(salary) as  salary from t_access_times group by username;
Query ID = wangshumin_20180320235451_bd2c3acd-7dc7-4741-bd3d-e544dff36070
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0021, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0021/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0021
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2018-03-20 23:54:58,802 Stage-1 map = 0%,  reduce = 0%
2018-03-20 23:55:08,144 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 3.61 sec
2018-03-20 23:55:14,531 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 4.78 sec
MapReduce Total cumulative CPU time: 4 seconds 780 msec
Ended Job = job_1521538874183_0021
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 4.78 sec   HDFS Read: 7531 HDFS Write: 10 SUCCESS
Total MapReduce CPU Time Spent: 4 seconds 780 msec
OK
A 43
B 45
Time taken: 24.693 seconds, Fetched: 2 row(s)
hive> select username , month ,sum(salary) as  salary from t_access_times group by username,month;
Query ID = wangshumin_20180320235607_f23413a3-5461-48d9-9be7-7c580f035311
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0022, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0022/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0022
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2018-03-20 23:56:16,453 Stage-1 map = 0%,  reduce = 0%
2018-03-20 23:56:36,292 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.69 sec
2018-03-20 23:56:55,231 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 3.87 sec
MapReduce Total cumulative CPU time: 3 seconds 870 msec
Ended Job = job_1521538874183_0022
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 3.87 sec   HDFS Read: 7901 HDFS Write: 52 SUCCESS
Total MapReduce CPU Time Spent: 3 seconds 870 msec
OK
A 2015-01 33
A 2015-02 10
B 2015-01 30
B 2015-02 15
Time taken: 49.991 seconds, Fetched: 4 row(s)
hive> select A.*,B.* FROM
    > (select username,month,sum(salary) as salary from t_access_times group by username,month) A 
    > inner join 
    > (select username,month,sum(salary) as salary from t_access_times group by username,month) B
    > on
    > A.username=B.username;
Query ID = wangshumin_20180320235702_41a56641-8914-44ff-91d3-e078851e5396
Total jobs = 5
Launching Job 1 out of 5
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0023, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0023/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0023
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2018-03-20 23:57:11,093 Stage-1 map = 0%,  reduce = 0%
2018-03-20 23:57:26,772 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 8.57 sec
2018-03-20 23:57:33,091 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 9.8 sec
MapReduce Total cumulative CPU time: 9 seconds 800 msec
Ended Job = job_1521538874183_0023
Launching Job 2 out of 5
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0024, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0024/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0024
Hadoop job information for Stage-3: number of mappers: 1; number of reducers: 1
2018-03-20 23:57:42,263 Stage-3 map = 0%,  reduce = 0%
2018-03-20 23:57:51,630 Stage-3 map = 100%,  reduce = 0%, Cumulative CPU 2.23 sec
2018-03-20 23:57:57,909 Stage-3 map = 100%,  reduce = 100%, Cumulative CPU 3.29 sec
MapReduce Total cumulative CPU time: 3 seconds 290 msec
Ended Job = job_1521538874183_0024
Stage-7 is selected by condition resolver.
Stage-8 is filtered out by condition resolver.
Stage-2 is filtered out by condition resolver.
18/03/20 23:58:05 WARN conf.Configuration: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-20_23-57-02_739_365299963402973038-1/-local-10014/jobconf.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.retry.interval;  Ignoring.
18/03/20 23:58:05 WARN conf.Configuration: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-20_23-57-02_739_365299963402973038-1/-local-10014/jobconf.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.attempts;  Ignoring.
Execution log at: /tmp/wangshumin/wangshumin_20180320235702_41a56641-8914-44ff-91d3-e078851e5396.log
2018-03-20 23:58:06 Starting to launch local task to process map join; maximum memory = 518979584
2018-03-20 23:58:06 Dump the side-table for tag: 1 with group count: 2 into file: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-20_23-57-02_739_365299963402973038-1/-local-10005/HashTable-Stage-4/MapJoin-mapfile01--.hashtable
2018-03-20 23:58:07 Uploaded 1 File to: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-20_23-57-02_739_365299963402973038-1/-local-10005/HashTable-Stage-4/MapJoin-mapfile01--.hashtable (346 bytes)
2018-03-20 23:58:07 End of local task; Time Taken: 0.995 sec.
Execution completed successfully
MapredLocal task succeeded
Launching Job 4 out of 5
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_1521538874183_0025, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0025/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0025
Hadoop job information for Stage-4: number of mappers: 1; number of reducers: 0
2018-03-20 23:58:15,642 Stage-4 map = 0%,  reduce = 0%
2018-03-20 23:58:20,955 Stage-4 map = 100%,  reduce = 0%, Cumulative CPU 1.1 sec
MapReduce Total cumulative CPU time: 1 seconds 100 msec
Ended Job = job_1521538874183_0025
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 9.8 sec   HDFS Read: 7298 HDFS Write: 208 SUCCESS
Stage-Stage-3: Map: 1  Reduce: 1   Cumulative CPU: 3.29 sec   HDFS Read: 7299 HDFS Write: 208 SUCCESS
Stage-Stage-4: Map: 1   Cumulative CPU: 1.1 sec   HDFS Read: 5279 HDFS Write: 208 SUCCESS
Total MapReduce CPU Time Spent: 14 seconds 190 msec
OK
A 2015-01 33 A 2015-01 33
A 2015-01 33 A 2015-02 10
A 2015-02 10 A 2015-01 33
A 2015-02 10 A 2015-02 10
B 2015-01 30 B 2015-01 30
B 2015-01 30 B 2015-02 15
B 2015-02 15 B 2015-01 30
B 2015-02 15 B 2015-02 15
Time taken: 80.33 seconds, Fetched: 8 row(s)
hive> select A.*,B.* FROM
    > (select username,month,sum(salary) as salary from t_access_times group by username,month) A 
    > inner join 
    > (select username,month,sum(salary) as salary from t_access_times group by username,month) B
    > on
    > A.username=B.username
    > where B.month <= A.month;
Query ID = wangshumin_20180320235952_a81bcf0b-5d0d-41c1-8c81-b5028343387f
Total jobs = 5
Launching Job 1 out of 5
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0026, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0026/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0026
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2018-03-20 23:59:58,951 Stage-1 map = 0%,  reduce = 0%
2018-03-21 00:00:06,264 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 2.12 sec
2018-03-21 00:00:12,521 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 3.31 sec
MapReduce Total cumulative CPU time: 3 seconds 310 msec
Ended Job = job_1521538874183_0026
Launching Job 2 out of 5
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0027, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0027/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0027
Hadoop job information for Stage-3: number of mappers: 1; number of reducers: 1
2018-03-21 00:00:20,962 Stage-3 map = 0%,  reduce = 0%
2018-03-21 00:00:27,339 Stage-3 map = 100%,  reduce = 0%, Cumulative CPU 1.32 sec
2018-03-21 00:00:33,613 Stage-3 map = 100%,  reduce = 100%, Cumulative CPU 2.36 sec
MapReduce Total cumulative CPU time: 2 seconds 360 msec
Ended Job = job_1521538874183_0027
Stage-7 is selected by condition resolver.
Stage-8 is filtered out by condition resolver.
Stage-2 is filtered out by condition resolver.
18/03/21 00:00:38 WARN conf.Configuration: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-20_23-59-52_956_412420808084745003-1/-local-10014/jobconf.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.retry.interval;  Ignoring.
18/03/21 00:00:38 WARN conf.Configuration: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-20_23-59-52_956_412420808084745003-1/-local-10014/jobconf.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.attempts;  Ignoring.
Execution log at: /tmp/wangshumin/wangshumin_20180320235952_a81bcf0b-5d0d-41c1-8c81-b5028343387f.log
2018-03-21 00:00:39 Starting to launch local task to process map join; maximum memory = 518979584
2018-03-21 00:00:40 Dump the side-table for tag: 1 with group count: 2 into file: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-20_23-59-52_956_412420808084745003-1/-local-10005/HashTable-Stage-4/MapJoin-mapfile21--.hashtable
2018-03-21 00:00:40 Uploaded 1 File to: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-20_23-59-52_956_412420808084745003-1/-local-10005/HashTable-Stage-4/MapJoin-mapfile21--.hashtable (346 bytes)
2018-03-21 00:00:40 End of local task; Time Taken: 0.982 sec.
Execution completed successfully
MapredLocal task succeeded
Launching Job 4 out of 5
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_1521538874183_0028, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0028/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0028
Hadoop job information for Stage-4: number of mappers: 1; number of reducers: 0
2018-03-21 00:00:48,950 Stage-4 map = 0%,  reduce = 0%
2018-03-21 00:00:55,308 Stage-4 map = 100%,  reduce = 0%, Cumulative CPU 1.4 sec
MapReduce Total cumulative CPU time: 1 seconds 400 msec
Ended Job = job_1521538874183_0028
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 3.31 sec   HDFS Read: 7298 HDFS Write: 208 SUCCESS
Stage-Stage-3: Map: 1  Reduce: 1   Cumulative CPU: 2.36 sec   HDFS Read: 7299 HDFS Write: 208 SUCCESS
Stage-Stage-4: Map: 1   Cumulative CPU: 1.4 sec   HDFS Read: 5649 HDFS Write: 156 SUCCESS
Total MapReduce CPU Time Spent: 7 seconds 70 msec
OK
A 2015-01 33 A 2015-01 33
A 2015-02 10 A 2015-01 33
A 2015-02 10 A 2015-02 10
B 2015-01 30 B 2015-01 30
B 2015-02 15 B 2015-01 30
B 2015-02 15 B 2015-02 15
Time taken: 64.556 seconds, Fetched: 6 row(s)
hive> select A.username,A.month,max(A.salary) as salary,sum(B.salary) as accumulate
    > from 
    > (select username,month,sum(salary) as salary from t_access_times group by username,month) A 
    > inner join 
    > (select username,month,sum(salary) as salary from t_access_times group by username,month) B
    > on
    > A.username=B.username
    > where B.month <= A.month
    > group by A.username,A.month
    > order by A.username,A.month;
Query ID = wangshumin_20180321000147_2504028d-aeee-4f3d-9e45-377e533d73ec
Total jobs = 7
Launching Job 1 out of 7
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0029, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0029/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0029
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2018-03-21 00:01:54,503 Stage-1 map = 0%,  reduce = 0%
2018-03-21 00:02:00,730 Stage-1 map = 100%,  reduce = 0%, Cumulative CPU 1.35 sec
2018-03-21 00:02:07,019 Stage-1 map = 100%,  reduce = 100%, Cumulative CPU 2.41 sec
MapReduce Total cumulative CPU time: 2 seconds 410 msec
Ended Job = job_1521538874183_0029
Launching Job 2 out of 7
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0030, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0030/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0030
Hadoop job information for Stage-5: number of mappers: 1; number of reducers: 1
2018-03-21 00:02:14,377 Stage-5 map = 0%,  reduce = 0%
2018-03-21 00:02:19,701 Stage-5 map = 100%,  reduce = 0%, Cumulative CPU 1.43 sec
2018-03-21 00:02:27,003 Stage-5 map = 100%,  reduce = 100%, Cumulative CPU 2.56 sec
MapReduce Total cumulative CPU time: 2 seconds 560 msec
Ended Job = job_1521538874183_0030
Stage-9 is selected by condition resolver.
Stage-10 is filtered out by condition resolver.
Stage-2 is filtered out by condition resolver.
18/03/21 00:02:30 WARN conf.Configuration: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-21_00-01-47_625_1658391933223343594-1/-local-10016/jobconf.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.retry.interval;  Ignoring.
18/03/21 00:02:30 WARN conf.Configuration: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-21_00-01-47_625_1658391933223343594-1/-local-10016/jobconf.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.attempts;  Ignoring.
Execution log at: /tmp/wangshumin/wangshumin_20180321000147_2504028d-aeee-4f3d-9e45-377e533d73ec.log
2018-03-21 00:02:31 Starting to launch local task to process map join; maximum memory = 518979584
2018-03-21 00:02:32 Dump the side-table for tag: 1 with group count: 2 into file: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-21_00-01-47_625_1658391933223343594-1/-local-10007/HashTable-Stage-6/MapJoin-mapfile41--.hashtable
2018-03-21 00:02:32 Uploaded 1 File to: file:/tmp/wangshumin/76745d24-2239-4efe-af2e-6133240d72f3/hive_2018-03-21_00-01-47_625_1658391933223343594-1/-local-10007/HashTable-Stage-6/MapJoin-mapfile41--.hashtable (346 bytes)
2018-03-21 00:02:32 End of local task; Time Taken: 0.974 sec.
Execution completed successfully
MapredLocal task succeeded
Launching Job 4 out of 7
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_1521538874183_0031, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0031/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0031
Hadoop job information for Stage-6: number of mappers: 1; number of reducers: 0
2018-03-21 00:02:39,605 Stage-6 map = 0%,  reduce = 0%
2018-03-21 00:02:45,889 Stage-6 map = 100%,  reduce = 0%, Cumulative CPU 1.32 sec
MapReduce Total cumulative CPU time: 1 seconds 320 msec
Ended Job = job_1521538874183_0031
Launching Job 5 out of 7
Number of reduce tasks not specified. Estimated from input data size: 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_1521538874183_0032, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0032/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0032
Hadoop job information for Stage-3: number of mappers: 1; number of reducers: 1
2018-03-21 00:02:53,381 Stage-3 map = 0%,  reduce = 0%
2018-03-21 00:02:59,704 Stage-3 map = 100%,  reduce = 0%, Cumulative CPU 0.96 sec
2018-03-21 00:03:05,955 Stage-3 map = 100%,  reduce = 100%, Cumulative CPU 1.97 sec
MapReduce Total cumulative CPU time: 1 seconds 970 msec
Ended Job = job_1521538874183_0032
Launching Job 6 out of 7
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_1521538874183_0033, Tracking URL = http://centoshostnameKL1:8088/proxy/application_1521538874183_0033/
Kill Command = /home/wangshumin/app/hadoop-2.4.1/bin/hadoop job  -kill job_1521538874183_0033
Hadoop job information for Stage-4: number of mappers: 1; number of reducers: 1
2018-03-21 00:03:13,345 Stage-4 map = 0%,  reduce = 0%
2018-03-21 00:03:21,815 Stage-4 map = 100%,  reduce = 0%, Cumulative CPU 0.87 sec
2018-03-21 00:03:31,480 Stage-4 map = 100%,  reduce = 100%, Cumulative CPU 2.36 sec
MapReduce Total cumulative CPU time: 2 seconds 360 msec
Ended Job = job_1521538874183_0033
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 1  Reduce: 1   Cumulative CPU: 2.41 sec   HDFS Read: 7299 HDFS Write: 208 SUCCESS
Stage-Stage-5: Map: 1  Reduce: 1   Cumulative CPU: 2.56 sec   HDFS Read: 7300 HDFS Write: 208 SUCCESS
Stage-Stage-6: Map: 1   Cumulative CPU: 1.32 sec   HDFS Read: 5930 HDFS Write: 212 SUCCESS
Stage-Stage-3: Map: 1  Reduce: 1   Cumulative CPU: 1.97 sec   HDFS Read: 5441 HDFS Write: 212 SUCCESS
Stage-Stage-4: Map: 1  Reduce: 1   Cumulative CPU: 2.36 sec   HDFS Read: 5627 HDFS Write: 64 SUCCESS
Total MapReduce CPU Time Spent: 10 seconds 620 msec
OK
A 2015-01 33 33
A 2015-02 10 43
B 2015-01 30 30
B 2015-02 15 45
Time taken: 104.982 seconds, Fetched: 4 row(s)
hive> 
hive级联求和 级联求和的例子,通过这个例子可以掌握一类相同的报表级联求和的题目 立即下载

相关推荐

【Hive报错】Hive报错Expression Not In Group By Key解决方法

SQL例如以下会报错: select sum(time) as time, roadCoding, upstreamOrDownstream from historicalroaddata where ... 报以下roadcoding、upstreamOrDownstream的错误 FAILED: SemanticException [Error 10025]: Line 1:12 Expression not in GROUP BY key ‘roadcoding′ 解决方法:使用collect

学习笔记 2万+

保姆级教程:手把手教你从NASA Earthdata下载ASTER L2地表温度数据(附shp文件拖拽技巧)

本文提供了一份详细的NASA Earthdata平台ASTER L2地表温度数据下载教程,涵盖账号注册、数据筛选、shp文件拖拽技巧及质量检查等关键步骤。特别适合遥感领域初学者,帮助快速掌握高效获取ASTER L2T数据的方法,适用于城市热岛效应和农业监测等研究。

weixin_30736301的博客 470

Expression not in GROUP BY key

改成

weixin_42656511的博客 2430

认知网络分析实战:用Python复现课堂对话研究(含LSA代码)

本文通过Python实战,详细演示了如何运用认知网络分析(ENA)和滞后序列分析(LSA)两种方法,对课堂对话数据进行深度挖掘。文章提供了从数据清洗、行为编码到网络构建、序列统计及可视化的完整代码流程,帮助教育研究者和数据分析师量化分析对话中的认知结构与动态互动模式,从而获得超越文本表面的研究洞见。

weixin_28559803的博客 155

Open Lovable 网站克隆AI工具超详细实战教程(含环境配置、排错与代码修改)

本教程面向有一定计算机基础的新手用户,提供一份全面、深入的 Open Lovable 使用指南。从开发环境搭建、API密钥获取、项目部署到网站克隆、代码下载、本地运行与二次开发,涵盖全流程细节与常见问题解决方案。通过本教程,新手可掌握如何利用AI驱动的Open Lovable工具,将任意目标网站智能复刻为结构清晰、可编辑的现代前端项目(React/Vite),实现快速原型开发与技术学习。

hy行者勇哥的博客 4965

【Hive】SemanticException Expression not in group by key

执行Hive语句,报错SemanticException Expression not in group by key。 原因是我的select语句中有列,既不在group by子句中,也没有聚合。

Asher117的博客 1062

黑猫带你学eMMC协议第22篇:emmc可靠写详解(Write Reliability)

1 前言 1.1 声明 本文依据eMMC JEDEC5.1、网络资料及个人工作经验整理而成,如有部分错误请留言。 本文部分内容可能源自网络,侵删。 本文结合eMMC JEDEC5.1协议手册查看效果更佳。 1.2 内容提要 1、什么是可靠性写属性(Write Reliability)? 2、可靠写和普通的写有什么区别? 3、设置可靠写的流程及流程框图。 4、可靠写需要遵循哪些规则? 1.3 参考链接 本文主要参考链接:http://www.up48.com/cn/support/8_37.html 2 什么

黑猫奥利奥的博客 3125

解决 FAILED: SemanticException [Error 10025]: Expression not in GROUP BY key

这个是hive中group by 的使用错误, 注意,如果你就是要这样搜索的话,那么collect_set()函数包围非group by字段后即可使用。 实际上group by 分类的字段应该来源于上面的select ,如 select id ,name那么你group by的字段只能是 id和name ...

alongwaywith的博客 6256

Winform从入门到精通(38)——StatusStrip(史上最全)

本文介绍StatusStrip控件的详细用法,包含所有属性和事件,绝对史上最全!

qq_34059233的博客 2759

手把手教你学Simulink——基于Simulink的CLLC谐振变换器双向对称控制

本文介绍了一种基于Simulink的CLLC谐振变换器双向对称控制方法。针对CLLC拓扑的多阶谐振特性,采用固定频率、50%占空比、仅调节相位差的对称控制策略,实现了宽电压范围调节和全负载ZVS软开关。详细阐述了Simulink建模步骤,包括功率级搭建、相位差生成逻辑和双向切换实现,并通过仿真验证了稳态性能和双向无缝切换能力。该方法解决了传统PFM控制的不足,具有控制简单、效率高、易于工程实现的优势,适用于车载充电和储能系统等双向功率应用场景。

MHD0815的博客 302

hive中group by 提示Expression Not In Group By Key的解决办法

一 hive中group by 提示Expression Not In Group By Key 二  异常原因: hive中group by的时候 hive>  select   count(market)    province ,market  from market_table ;    会提示: FAILED: SemanticExcep

似水流年 3万+

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Hive实战案例3——级联求和accumulate

Hive实战案例3——级联求和accumulate需求:有如下访客访问次数统计表 t_access_times访客月份访问次数A2015-015A2015-0115B2015-015A2015-018B2015-0125A2015-015A2015-024A2015-026B2015-0210B2015-025……………… 需要输出报表:t_access_times_accumulate访客月份月...

大JAVA解决方案 757

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

神级Hive的SQL案列

Hive实战案例——级联求和 需求: 有如下访客访问次数统计表 t_access_times 访客 月份 访问次数 A 2015-01 5 A 2015-01 15 B 2015-01 5 A 2015-01 8 B 2015-01 25 A 2015-01 5 A...

Jin__nan的博客 685

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

hive:Group by 问题:Expression Not In Group By Key

hive又遇到了问题: 原来的mysql中sql语句为 SELECT DATEBUF, CITYID, CHANNELID FROM STAT_CVCHNEW WHERE DATEBUF>=20110517 AND DATEBUF 得到的结果应该是是按DATEBUF和CITYID分组,然后每组对应CHANNELID的第一个值 但在hive中报错 FAILED: SemanticExce

wenlong237的专栏 2万+

Hive 错误FAILED: SemanticException [Error 10025]: Line 1:40 Expression not in GROUP BY key

Hive 错误 Expression not in GROUP BY key Hive 支持基本的SQL , 但是 Hive 与 MySQL 还是有 些许区别的。 其中在开始使用 Hive 的时候会遇到 Expression not in GROUP BY key 的错误,错误原因如下: 问题原因 在 Group by 子句中,Select 查询的列,要么需要是 Group by 中的列,要么得是用聚合函数(比如 sum、count 等)加工过的列。不支持直接引用非 Group by 的列。这一点和 M

蒯厅博客 3048

Hive(十三)--Group by 问题:Expression Not In Group By Key

hive又遇到了问题: 原来的MySQL中sql语句为 [sql] view plain copy SELECT  DATEBUF, CITYID, CHANNELID FROM STAT_CVCHNEW WHERE DATEBUF>=20110517 AND DATEBUFGROUP BY DATEBUF, CITYID;  

William Zhao's notes 1万+

[hive 报错]:FAILED:SemanticException [Error 10025] Expression not in GROUP BY key

问题:FAILED: SemanticException [Error 10025]: Line 104:25 Expression not in GROUP BY key 'day' 其实这个日志已经告诉你问题出在哪里了,line104对应的那个SQL语句select * from where * group by key1,key2; group by key需加上缺失的key(day...

Fly Away的专栏 1万+

Hive 错误 Expression not in GROUP BY key

参考文章: https://help.aliyun.com/knowledge_detail/54250.html Hive 支持基本的SQL , 但是 Hive 与 MySQL 还是有 些许区别的。 其中在开始使用 Hive 的时候会遇到Expression not in GROUP BY key 的错误,错误原因如下: 问题原因 在 Group by 子句中...

迎难而上 3万+

Hive 报错 FAILED: SemanticException [Error 10025]: Line 2:35 Expression not in GROUP BY key 'videoId'

参考:https://stackoverflow.com/questions/5746687/hive-expression-not-in-group-by-key 解决:在hql中,要在select..group by..中要展示某个字段,就必须对这个字段进行group by,否则就不要select那个字段 ...

qq_31024823的博客 6276

hive sql报错FAILED: SemanticException Line 0:-1 Both left and right aliases encountered in JOIN

在hql脚本时报错FAILED: SemanticException Line 0:-1 Both left and right aliases encountered in JOIN ,由于连接条件导致hql不能执行,网上查到了解决办法https://stackoverflow.com/questions/39852325/both-left-and-right-aliases-encounte...

bigdataprimary的博客 1万+

hive-级联求和

本人思路,欢迎大佬指出错误 级联求和的思路: :首先我们针对一个求每月之中每天产品递增的销量,求解; 1.明确目的,针对此需求。要的是一月之中的每天数据,分组应是 day。 2.每天递增,说明只要当前天以及本月当前天之前的day的销量总和。 3.运用inner join连接方式和where b.day<=a.day针对此问题把当前天以及之前的天数销量排查出来,做聚合操作。 4....

mswuxianshen的博客 586

hive学习6:hive级联求和

  说明:      级联求和,不仅hive会使用,其实mysql或者Oracle也会用到的,我这边先用mysql实现下,具体需求如下: username month times A 2018-02 5 A 2018-03 10 A 2018-04 10 B 2018-02 5 B 2018-03 1...

每天进步一点 4438

Hive执行SQL报错FAILED: SemanticException[Error10025]: Line1:32 Expression not in GROUP BY key ‘orderid‘

原因 在Hive中,GROUP BY 后 SELECT 列的限制,Select 查询的列,要么需要是 Group by 中的列,要么得是用聚合函数( sum、count 、avg等)加工过的列。不支持直接引用原表中的列。

wufabao的博客 3164

Hive级联求和

Hive级联求和(通用方法) 1 创建表 create table t_salary_detail(username string,month string,salary int) row format delimited fields terminated by ','; 2 加载数据 load data local inpath '/root/hivedata/t_salary_detail.dat' into table t_salary_detail; 3 数据 A,2015-01,5 A,20

qq_36382679的博客 716
上一篇: 网站点击流数据分析
下一篇: Hive实战案例3——级联求和accumulate
王树民
博客等级 码龄10年 912粉丝 560原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值