一.简介

  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的更多相关文章

  1. 【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 ...

  2. hive lateral view 与 explode详解

    ref:https://blog.csdn.net/bitcarmanlee/article/details/51926530 1.explode hive wiki对于expolde的解释如下: e ...

  3. 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 ...

  4. hive 使用笔记(table format;lateral view)

    1. create table 创建一张目标表,指定分隔符和存储格式: create table tmp_2 (resource_id bigint ,v int) ROW FORMAT DELIMI ...

  5. hive splict, explode, lateral view, concat_ws

    hive> create table arrays (x array<string>) > row format delimited fields terminated by ...

  6. 【hive】lateral view的使用

    当使用UDTF函数的时候,hive只允许对拆分字段进行访问的 例如: select id,explode(arry1) from table; —错误 会报错FAILED: SemanticExcep ...

  7. Hive之侧视图(Lateral View)

    Lateral View和UDTF类功能函数一起使用,表中的每一行和UDTF函数输出的每一行进行连接,生成一张新的虚拟表,可以对UDTF产生的记录设置字段名称,新加的字段可以使用在sort by,gr ...

  8. hive 使用笔记(table format;lateral view横表转纵表)

    1. create table 创建一张目标表,指定分隔符和存储格式: create table tmp_2 (resource_id bigint ,v int) ROW FORMAT DELIMI ...

  9. Hive之explode和lateral view

    Hive之explode 一. explode, 行转列. 1.1. 用于array类型的数据 table_name 表名 array_col 为数组类型的字段 new_col array_col被e ...

随机推荐

  1. nodejs相关框架

    sails   https://sailsjs.com/documentation/concepts koa  koa 是由 Express 原班人马打造的,致力于成为一个更小.更富有表现力.更健壮的 ...

  2. Scheduling In Go

    https://www.ardanlabs.com/blog/2018/08/scheduling-in-go-part1.html https://blog.altoros.com/golang-i ...

  3. Visual-Based Autonomous Driving Deployment from a Stochastic and Uncertainty-Aware Perspective

    张宁 Visual-Based Autonomous Driving Deployment from a Stochastic and Uncertainty-Aware Perspective Le ...

  4. windows下安装zk

    1 下载安装包并解压 2 修改conf下配置文件名字 zoo_sample.cfg 文件名改为 zoo.cfg 3 启动zk zKServer.cmd 4启动客户端连接测试 zKCli.cmd 127 ...

  5. resources-plugin-2.6.pom.part.lock (没有那个文件或目录)

    由于 自定义 maven 仓库没权限 /home/repository 自定义目录 [root@localhost Service]# cat /etc/group|grep jenkins jenk ...

  6. Kafka Connect简介

    Kafka Connect简介 http://colobu.com/2016/02/24/kafka-connect/#more Kafka 0.9+增加了一个新的特性Kafka Connect,可以 ...

  7. (转)Intellij Idea工具栏添加打开选中文件的资源管理器位置

    背景:在idea的view>toolbar上面添加工具按钮,能够简化操作,现在添加打开资源管理按钮,后续功能待研究 Intellij Idea工具栏添加打开选中文件的资源管理器位置 工具栏-右击 ...

  8. python读取excel数据并以第一行标题加内容组成字典格式返回

    excel结构如图所示: 代码: import xlrd ''' 通用获取excel数据 @:param path excel文件路径 @:param sheet_name excel文件里面shee ...

  9. JVM方法栈的工作过程,方法栈和本地方法栈有什么区别。

    JVM的本地方法栈   对于一个运行中的Java程序而言,它还可能会用到一些跟本地方法相关的数据区.当某个线程调用一个本地方法时,它就进入了一个全新的并且不再受虚拟机限制的世界.本地方法可以通过本地方 ...

  10. Java中参数始终是按值传递

    Java中参数始终是按值传递. public class Main { public static void main(String[] args) { int x = 5; change(x); S ...