Presto has an UNNEST
function to explode columns made of arrays. Is there a similar one for Hive?
See docs for UNNEST
function of Presto here.
相关问题
-
hive: cast array
> into map - Find function in HIVE
- Hive Tez reducers are running super slow
- Set parquet snappy output file size is hive?
- Hive 'cannot alter table' error
相关文章
- 在hive sql里怎么把"2020-10-26T08:41:19.000Z"这个字符串转换成年月日
- SQL query Frequency Distribution matrix for produc
- Cloudera 5.6: Parquet does not support date. See H
- converting to timestamp with time zone failed on A
- Hive error: parseexception missing EOF
- ClassNotFoundException: org.apache.spark.SparkConf
- How to get previous day date in Hive
- Hive's hour() function returns 12 hour clock v
Use
lateral view [outer] explode
. A lateral view first applies the UDTF to each row of base table and then joins resulting output rows to the input rows to form a virtual table having the supplied table alias.This is example from Presto migration from Hive docs:
And example from Hive Lateral View docs:
Use
OUTER
keyword to generate rows even when aLATERAL VIEW
usually would not generate a row:In this example the
array
is empty, but rows fromsrc
will be returnedLateral view can be used not only with
explode()
UDTF. See the list of Hive embedded UDTFs with examples. Also you can write your own UDTF and use it withLATERAL VIEW
.