在hive中交叉应用等效值?

vc6uscn9  于 2021-06-27  发布在  Hive
关注(0)|答案(2)|浏览(518)

我想在aws emr配置单元中创建交叉应用的效果。我这里有一个在SQLServer2017中运行的示例代码。

with r as (
select 1 as d
union all
select 2 as d
)
select * from r
cross apply (select 'f' as u) e;

如何在emr hive中运行与此等效的程序?
我已经查看了侧视图文档,但是所有的引用都爆炸了,我没有数组。

kknvjkwl

kknvjkwl1#

最后,我只添加了一个带有单个值的额外字段,并将两个表连接在一起,从而产生相同的效果。
最后看起来像:

with d as (
select column, 'AreYouKiddingMe' as k from table
), e as (
select column2, 'AreYouKiddingMe' as k from table2
)
select * from d inner join e on d.k = e.k
jtoj6r0c

jtoj6r0c2#

而不是做 CROSS APPLY 你可以这样做 CROSS JOIN 对你来说。f、 电子邮件:

SET hive.strict.checks.cartesian.product = false;

WITH r AS (
    SELECT 1 AS d
    UNION ALL
    SELECT 2 AS d
)
SELECT *
FROM r
CROSS JOIN (SELECT 'f' AS u) e;

相关问题