我尝试在hive上重写关注查询
select
TFCT_CHARGE.SUBS_KEY,
TFCT_CHARGE.PRODUCT_KEY,
TFCT_CHARGE.CHARGE_NVAL,
TFCT_CHARGE.B_SUBS_KEY,
TFCT_CHARGE.DELETE_DT,
HFCT_SUBS_SEGMENT.SEGMENT_KEY,
TFCT_CHARGE.EVENT_DT,
TFCT_CHARGE.DWH_SRC_TABLE_KEY
from
TFCT_CHARGE LEFT OUTER JOIN HFCT_SUBS_SEGMENT
ON (
TFCT_CHARGE.B_SUBS_KEY = HFCT_SUBS_SEGMENT.SUBS_KEY and
TFCT_CHARGE.EVENT_DT >= HFCT_SUBS_SEGMENT.EFF_DT and
TFCT_CHARGE.EVENT_DT < HFCT_SUBS_SEGMENT.EXP_DT and
HFCT_SUBS_SEGMENT.SEGMENT_TYPE_KEY = 1)
但是有不平等的查询。 任何人都可以提示我一些解决方法吗? TNX!
答案 0 :(得分:0)
模拟非等左外连接:
请在此处查看我的答案代码:Hive: work around for non equi left join
答案 1 :(得分:-1)
这很容易)))
select
TFCT_CHARGE.SUBS_KEY,
TFCT_CHARGE.PRODUCT_KEY,
TFCT_CHARGE.CHARGE_NVAL,
TFCT_CHARGE.B_SUBS_KEY,
TFCT_CHARGE.DELETE_DT,
HFCT_SUBS_SEGMENT.SEGMENT_KEY,
TFCT_CHARGE.EVENT_DT,
TFCT_CHARGE.DWH_SRC_TABLE_KEY
from
TFCT_CHARGE INNER JOIN HFCT_SUBS_SEGMENT
ON (
TFCT_CHARGE.B_SUBS_KEY = HFCT_SUBS_SEGMENT.SUBS_KEY
HFCT_SUBS_SEGMENT.SEGMENT_TYPE_KEY = 1)
where
TFCT_CHARGE.EVENT_DT >= HFCT_SUBS_SEGMENT.EFF_DT and
TFCT_CHARGE.EVENT_DT < HFCT_SUBS_SEGMENT.EXP_DT and