Array of the project into columns in the hive

Just wondering, is it possible to project an array onto individual columns in a hive in one step?

I have this request

select split(activity_data,":") as ad from mpod_audit_log 

where the column declaration contains 10 separate fields that I would like to project into 10 columns.

+4
source share
1 answer

Yes it is possible. I know that there are two ways to do this:

  • Use indexes to access array elements:

    select split (activity_data, ":") [0] as col1, split (activity_data, ":") [1] as col2 ... from mpod_audit_log

  • explained this post. Blow up an array of objects in the hive

+5
source

Source: https://habr.com/ru/post/1487278/


All Articles