title: Can I do a LEFT JOIN LATERAL in Hive?
body: <p>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.</p>
  
  <p>Here is an example from Postgres: (Forgive my crude example):</p>
  
  <pre><code>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 &lt; lhs.date_time and subject_id = lhs.subject_id ) rhs1 ON true;
  </code></pre>