Hive 子查询结果复用 with as 创建临时中间表

查询到的用法如下

with tmp0 as (
    select a, b, c from test0
),
tmp1 as(
    select a, b, c from test1
)
select
    db0.a, db1.a, db2.a
from
    tmp0 db0
left join
    tmp0 db1
on
    db0.b = db1.b
left join
    tmp1 db2
on
    db0.b = db2.b

实测,至少在某些版本中,不太好使,临时表还是会生成多次

如果临时表中有一些随机元素,几次生成的还是会不同

参考文献:

https://www.cnblogs.com/30go/p/10116815.html

原文地址:https://www.cnblogs.com/jhc888007/p/11959543.html