当前位置:网站首页>Another implementation of lateral view explode

Another implementation of lateral view explode

2022-08-09 09:22:00 research monk who doesn't like research

Lateral view explode results:

If you don't use lateral view explode, you can do it like this:

Steps:

1. Turn one record into n identical records, ie

Put the serial number value in front, num is the key, answers[num] is the desired value,

2. The implementation of the above figure is achieved by connecting two tables,

The implementation of 3.B table is to generate incremental numbers, use space to get n spaces, and add serial numbers before the corresponding spaces

--Method 1selectrow_number() over() as idfrom(select split(space(299), ' ') as x) tlateral view explode(x) ex;--Method 2select pos + 1from(select 1 as id_start, 300 as id_end) tlateral view posexplode(split(space(id_end - id_start), ' ')) ex as pos, blank;

posexplode(array) t as pos, blank, only the first field has a value, which is the position, the second is empty, if it is a map, there is a value

原网站

版权声明
本文为[research monk who doesn't like research]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/221/202208090911567513.html