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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM