我有两张桌子。表 A 包含 3 列:用户 ID、开始日期和结束日期。带有事件和日期时间戳的表 B。我想根据表 A 将表 B 聚合到开始日期和结束日期之间的日期时间。所以像......
select a.userid, count(distinct b.eventid) as events
from table a
inner join table b
on a.userid=b.userid
and b.datetime between a.starttime and b.endtime
group by a.userid
但是 Hive 不喜欢那样……我正在使用 Hadoop HortonWorks。将不胜感激任何指导!