当前位置:网站首页>lateral view explode的另一种实现方式
lateral view explode的另一种实现方式
2022-08-09 09:12:00 【不爱研究的研究僧】
lateral view explode实现结果:
如果不用lateral view explode,可以这样实现:
步骤:
1.将一条记录变成n条一样的记录,即
前面再带上序号值,num是key,answers[num]即为所要的value,
2. 上图的实现通过两表连接的方式,
3.B表的实现就是生成递增数字,利用space得到n个空格,在对应空格前加上序号
--方法1
select
row_number() over() as id
from
(select split(space(299), ' ') as x) t
lateral view explode(x) ex;
--方法2
select pos + 1
from
(select 1 as id_start, 300 as id_end) t
lateral view posexplode(split(space(id_end - id_start), ' ')) ex as pos, blank;
posexplode(数组) t as pos, blank,只有第一个字段有值,是位置,第二个为空,如果是map就有值
边栏推荐
猜你喜欢
随机推荐
HD Satellite Map Browser
parse <compoN> error: Custom Component‘name should be form of my-component, not myComponent or MyCom
编程memonic chant、trick
MySQL查漏补缺(四)存储过程和游标
Jfinal loading configuration file principle
.net 控件calendar 基础用法
MySQL锁
不支持关键字: 'Provider'
数据治理(四):数据仓库数据质量管理
AES/ECB/PKCS5Padding加解密
算术表达式求值演示
BUUCTF MISC brush notes (2)
Module模块化编程的优点有哪些
MySQL transaction isolation
MySQL索引
UE4 RTS frame selection function implementation
Ovie map computer terminal and mobile terminal can not be used, is there any alternative map tool
on duplicate key update
These 12 GIS software are better than the other
mysql优化——show processlist命令详解