Hive聚合函数和表生成函数
来源:互联网 发布:5g网络g什么意思 编辑:程序博客网 时间:2024/05/22 17:13
一 聚合函数
1、count
2、sum
3、min
4、max
5、avg
二 实例
hive> select count(*),sum(sal),max(sal),min(sal),avg(sal) from emp;Total jobs = 1Launching Job 1 out of 1Number of reduce tasks determined at compile time: 1In 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 mapred.reduce.tasks=<number>Starting Job = job_201709011948_0004, Tracking URL = http://localhost:50030/jobdetails.jsp?jobid=job_201709011948_0004Kill Command = /opt/hadoop-1.2.1/libexec/../bin/hadoop job -kill job_201709011948_0004Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 12017-09-01 20:43:25,420 Stage-1 map = 0%, reduce = 0%2017-09-01 20:43:42,444 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 2.72 sec2017-09-01 20:44:10,270 Stage-1 map = 100%, reduce = 67%, Cumulative CPU 3.44 sec2017-09-01 20:44:12,320 Stage-1 map = 100%, reduce = 100%, Cumulative CPU 9.34 secMapReduce Total cumulative CPU time: 9 seconds 340 msecEnded Job = job_201709011948_0004MapReduce Jobs Launched: Job 0: Map: 1 Reduce: 1 Cumulative CPU: 9.34 sec HDFS Read: 635 HDFS Write: 35 SUCCESSTotal MapReduce CPU Time Spent: 9 seconds 340 msecOK16104236.012111.04800.06514.75Time taken: 86.66 seconds, Fetched: 1 row(s)
三 表生成函数
explode
四 实例
hive> select explode(map(1,'Tom',2,'Mary',3,'Mike'));Total jobs = 1Launching Job 1 out of 1Number of reduce tasks is set to 0 since there's no reduce operatorStarting Job = job_201709011948_0005, Tracking URL = http://localhost:50030/jobdetails.jsp?jobid=job_201709011948_0005Kill Command = /opt/hadoop-1.2.1/libexec/../bin/hadoop job -kill job_201709011948_0005Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 02017-09-01 20:46:33,297 Stage-1 map = 0%, reduce = 0%2017-09-01 20:46:47,588 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 3.27 sec2017-09-01 20:46:55,793 Stage-1 map = 100%, reduce = 100%, Cumulative CPU 3.27 secMapReduce Total cumulative CPU time: 3 seconds 270 msecEnded Job = job_201709011948_0005MapReduce Jobs Launched: Job 0: Map: 1 Cumulative CPU: 3.27 sec HDFS Read: 270 HDFS Write: 20 SUCCESSTotal MapReduce CPU Time Spent: 3 seconds 270 msecOK1Tom2Mary3MikeTime taken: 42.023 seconds, Fetched: 3 row(s)
阅读全文
0 0
- Hive聚合函数和表生成函数
- Hive自定义UDF和聚合函数UDAF
- Hive自定义UDF和聚合函数UDAF
- Hive的聚合函数
- Hive内置聚合函数
- Hive的高级聚合函数
- Hive聚合函数及采样函数详解
- Hive聚合函数及采样函数详解
- 聚合和成员函数
- 分组和聚合函数
- Hive学习之内置聚合函数
- Hive学习之自定义聚合函数
- Hive通用型自定义聚合函数(UDAF)
- Hive通用型自定义聚合函数(UDAF)
- Hive用户自定义聚合函数(UDAF)
- Hive用户自定义聚合函数(UDAF)
- 表的聚合函数
- 聚合函数和group by
- JDK中的设计模式之观察者模式
- poj2750——Potted Flower
- ACM Computer Factory poj3436(网络流-ek)
- HTTP常见状态码
- c语言
- Hive聚合函数和表生成函数
- 表单信息注册验证
- Linux进程控制编程
- 进程
- 棋类对战小游戏(VS2012 MFC)
- EA&UML日拱一卒-多任务编程超入门-(12)关于Semaphore,一个不得不说的实例
- POJ刷题指南
- 文件编程
- NYOJ 最少步数