Hive LATERAL VIEW 函数
来源:互联网 发布:jenkins python pdf 编辑:程序博客网 时间:2024/06/08 10:31
函数简介
lateral view 函数用于将数据一行转多列,一般与explode、split、collect_set函数一起使用
基本使用
案例:现在有一张学生绩效表,记录了每个学生的所有科目的成绩, 需要查询所有拿了A的学生数
现在使用lateral view + explode函数对数据进行拆解,多行变一行
select student_name,course_value from student_course LATERRAL VIEW explode(student) tpTable AS course_value
拆解完成之后所得数据如下
接下来就可以进行聚合分析了:
select course_value,count(distinct student_name) as stu_num from course_single group by course_value where course_value='A'
结果:
阅读全文
1 0
- Hive LATERAL VIEW 函数
- Hive Lateral view介绍
- hive lateral view语句
- hive中的Lateral View
- Hive Lateral view介绍
- Hive Lateral view介绍
- hive Lateral View语法
- HIVE lateral view
- Hive的Lateral View
- Hive Lateral view介绍
- hive Lateral View语法
- hive中的Lateral View
- HIVE lateral view
- HIVE lateral view
- Hive Lateral View
- hive中的Lateral View
- [Hive]Lateral View使用指南
- hive lateral view语句
- python经典100例(21-40)
- Oracle索引选择如何选择自己合适高效的方法呢
- Hive的常用函数操作
- Angular Js 基础知识
- python经典100例(41-60)
- Hive LATERAL VIEW 函数
- Oracle 11.2.0.4升级到11.2.0.4.18 详细步骤
- PAT A 1101. Quick Sort (25)
- hdu 5887 Herbs Gathering【dfs+贪心】
- Couple Net论文阅读笔记
- WSGI in Flask
- ddmlib(adb)监听设备的上下
- 模板模式
- Hive的分析函数操作