Hive Lateral View
一.简介
1.Lateral View 用于和UDTF函数【explode,split】结合来使用。
2.首先通过UDTF函数将数据拆分成多行,再将多行结果组合成一个支持别名的虚拟表。
3.主要解决在select使用UDTF做查询的过程中查询只能包含单个UDTF,不能包含其它字段以及多个UDTF的情况。
4.语法:LATERAL VIEW udtf(expression) tableAlias AS columnAlias (',' columnAlias)
5.案例:
select count(distinct(city)),count(distinct(name)) from user
LATERAL VIEW explode(like) myUser1 AS myCol1
LATERAL VIEW explode(age) myUser2 AS myCol2
Hive Lateral View的更多相关文章
- 【Hive学习之六】Hive Lateral View &视图&索引
环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 jdk8 hadoop-3.1.1 apache-hive-3.1.1 ...
- hive lateral view 与 explode详解
ref:https://blog.csdn.net/bitcarmanlee/article/details/51926530 1.explode hive wiki对于expolde的解释如下: e ...
- Hive lateral view explode
select 'hello', x from dual lateral view explode(array(1,2,3,4,5)) vt as x 结果是: hello 1 hello 2 ...
- hive 使用笔记(table format;lateral view)
1. create table 创建一张目标表,指定分隔符和存储格式: create table tmp_2 (resource_id bigint ,v int) ROW FORMAT DELIMI ...
- hive splict, explode, lateral view, concat_ws
hive> create table arrays (x array<string>) > row format delimited fields terminated by ...
- 【hive】lateral view的使用
当使用UDTF函数的时候,hive只允许对拆分字段进行访问的 例如: select id,explode(arry1) from table; —错误 会报错FAILED: SemanticExcep ...
- Hive之侧视图(Lateral View)
Lateral View和UDTF类功能函数一起使用,表中的每一行和UDTF函数输出的每一行进行连接,生成一张新的虚拟表,可以对UDTF产生的记录设置字段名称,新加的字段可以使用在sort by,gr ...
- hive 使用笔记(table format;lateral view横表转纵表)
1. create table 创建一张目标表,指定分隔符和存储格式: create table tmp_2 (resource_id bigint ,v int) ROW FORMAT DELIMI ...
- Hive之explode和lateral view
Hive之explode 一. explode, 行转列. 1.1. 用于array类型的数据 table_name 表名 array_col 为数组类型的字段 new_col array_col被e ...
随机推荐
- groupby 的妙用(注意size和count)
Pandas的groupby()功能很强大,用好了可以方便的解决很多问题,在数据处理以及日常工作中经常能施展拳脚. 今天,我们一起来领略下groupby()的魅力吧. 首先,引入相关package: ...
- Python3基础 print %xX 十六进制大小写
Python : 3.7.3 OS : Ubuntu 18.04.2 LTS IDE : pycharm-community-2019.1.3 ...
- Consider defining a bean of type 'com.*.*.feign.*FeignClient' in your configuration.
Description: Field *FeignClient in com.*.*.service.* required a bean of type '***********' that coul ...
- kerberos相关
1.kerberos认证覆盖问题 先显示指定KRB5CCNAME存储的路径 export KRB5CCNAME=/tmp/krb5cc_xxx kinit -kt /home/xxx.keytab x ...
- BladeX 部署centos启动顺序
一:启动dockerservice docker start二:启动mysqldocker start mysql三:启动Harborsystemctl restart docker(如有修改daem ...
- html中测试div、ul和li、table排列多个块
前面有三篇博文测试了这三种方式,一.相关博文:LODOP问答部分链接.该文用的是div定位,用的是所有小div相对于大div进行定位,大的div设置relative定位,小的设置absolute相对于 ...
- spark 更改日志输出级别
package com.ideal.test import org.apache.spark.{SparkConf, SparkContext} import org.apache.log4j.{Le ...
- (转)mysql使用Navicat 导出和导入数据库
mysql使用Navicat 导出和导入数据库 ps:在导入本地数据库的时候,要先建立相同的数据库,然后再运行sql文件,即可导入相应的数据库
- [转] spring-boot集成swagger2
经测,spring-boot版本使用1.5.2+时需使用springfox-swagger2版本2.5+(spring-boot 1.2 + springfox-swagger2 2.2 在未扫描ja ...
- 关于于c++中的类型转换
隐藏式类型转换 void test() { ; ; a = b; //此时发生的是默认的类型转 //(据说编译器是微软的编译器是不允许编译通过) std::cout << a <&l ...