
Ultimate access to all questions.
A data engineer is tasked with processing data from an e-commerce website, stored in the events table. The table captures various customer actions such as register, search, browse, add_to_cart, and more. The goal is to create a view that displays a unique collection of actions and items in the cart for each user. Which query achieves this?
A
SELECT user_id, array_distinct(event_name) AS event_history, flatten(array_distinct(collect_set(items.item_id))) AS cart_history FROM events GROUP BY user_id;_
B
SELECT user_id, collect_set(event_name) AS event_history, array_distinct(flatten(collect_set(items.item_id))) AS cart_history FROM events GROUP BY user_id;_
C
SELECT user_id, flatten(event_name) AS event_history, collect_set(flatten(array_distinct(items.item_id))) AS cart_history FROM events GROUP BY user_id;
D
SELECT user_id, array_distinct(event_name) AS event_history, collect_set(array_distinct(flatten(items:item_id))) AS cart_history FROM events GROUP BY user_id;_
E
SELECT user_id, array_distinct(event_name) AS event_history, collect_set(flatten(explode(items.))) AS cart_history FROM events GROUP BY user_id;_