camby
c5718928df
[feature-wip](array-type) support explode and explode_outer table function (#8766)
explode(ArrayColumn) desc:
> Create a row for each element in the array column.
explode_outer(ArrayColumn) desc:
> Create a row for each element in the array column. Unlike explode, if the array is null or empty, it returns null.
Usage example:
1. create a table with array column, and insert some data;
2. open enable_lateral_view and enable_vectorized_engine;
```
set enable_lateral_view = true;
set enable_vectorized_engine=true;
```
3. use explode_outer
```
> select * from array_test;
+------+------+--------+
| k1 | k2 | k3 |
+------+------+--------+
| 3 | NULL | NULL |
| 1 | 2 | [1, 2] |
| 2 | 3 | NULL |
| 4 | NULL | [] |
+------+------+--------+
> select k1,explode_column from array_test LATERAL VIEW explode_outer(k3) TempExplodeView as explode_column;
+------+----------------+
| k1 | explode_column |
+------+----------------+
| 1 | 1 |
| 1 | 2 |
| 2 | NULL |
| 4 | NULL |
| 3 | NULL |
+------+----------------+
```
4. explode usage example. explode return empty rows while the ARRAY is null or empty
```
> select k1,explode_column from array_test LATERAL VIEW explode(k3) TempExplodeView as explode_column;
+------+----------------+
| k1 | explode_column |
+------+----------------+
| 1 | 1 |
| 1 | 2 |
+------+----------------+
```
2022-04-08 12:11:04 +08:00
..
2022-03-17 10:08:31 +08:00
2021-11-17 10:18:35 +08:00
2022-03-11 17:21:47 +08:00
2022-03-20 23:06:54 +08:00
2022-04-02 22:08:50 +08:00
2021-12-28 10:39:54 +08:00
2020-11-28 18:36:49 +08:00
2021-11-24 10:39:29 +08:00
2021-11-17 10:18:35 +08:00
2020-11-28 18:36:49 +08:00
2022-01-13 15:30:38 +08:00
2021-12-24 21:23:11 +08:00
2022-04-08 12:11:04 +08:00
2021-01-03 15:45:22 +08:00
2021-08-18 15:56:06 +08:00
2022-03-28 10:50:41 +08:00
2022-03-20 23:06:54 +08:00
2022-02-09 13:06:37 +08:00
2022-01-16 10:39:21 +08:00
2022-02-09 13:05:31 +08:00
2022-04-02 22:08:50 +08:00
2020-12-16 21:58:34 +08:00