I would like to do a LATERAL JOIN in Hive. Is there any way to support this? In essence I want to use values in the rows on the LHS as parameters to arbitrary SQL on the RHS.
Here is an example from Postgres: (Forgive my crude example):
create table lhs (
subject_id integer,
date_time BIGINT );
create table events (
subject_id integer,
date_time BIGINT,
event_val integer );
SELECT * from lhs LEFT JOIN LATERAL ( select SUM(event_val) as val_sum, count(event_val) as ecnt from events WHERE date_time < lhs.date_time and subject_id = lhs.subject_id ) rhs1 ON true;