Hadoop 我能在蜂巢里做一个左侧连接吗?

Hadoop 我能在蜂巢里做一个左侧连接吗?,hadoop,join,hive,lateral,Hadoop,Join,Hive,Lateral,我想在蜂箱里做一个侧面连接。 有没有办法支持这一点?本质上,我希望使用LHS上的行中的值作为RHS上任意SQL的参数 以下是博士后的一个例子:请原谅我的粗俗例子: create table lhs ( subject_id integer, date_time BIGINT ); create table events ( subject_id integer, date_time BIGINT, event_val integer );

我想在蜂箱里做一个侧面连接。 有没有办法支持这一点?本质上,我希望使用LHS上的行中的值作为RHS上任意SQL的参数

以下是博士后的一个例子:请原谅我的粗俗例子:

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;
配置单元不支持左连接横向,请使用与您的查询等效的下面的查询。我已使用示例数据进行了测试,它产生了相同的结果

select subject_id,date_time,SUM(event_val) as val_sum,COUNT(event_val) as ecnt 
from (SELECT a.subject_id as subject_id ,
      a.date_time as date_time, b.date_time as bdate , b.event_val as event_val
      FROM events b LEFT OUTER JOIN lhs a 
      ON b.subject_id = a.subject_id) abc 
where bdate < date_time group by subject_id,date_time;

希望我能帮助您制定在hive中实现同样目标的方法。

谢谢。。我希望有更好的办法。。这种内部连接将创建大量数据,除非Hive对此很聪明。