繁体   English   中英

Ozzie 工作流中的插入和公用表表达式 (CTE)

[英]Insert and Common Table Expression (CTE) in Ozzie Workflow

我想让我的 Common Table Expression 和 Insert 语句在 Ozzie Workflow 中结合在一起,但它总是失败。

任何人都知道我们如何编写这些组合,一般代码是什么?

谢谢。

下面是我的代码:

set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;

insert into table A partition(date)
with test as
(select * from table B),
select col A as name1, select col B as name2 from test

我认为这与 CTE 无关。 你能试试 -

insert into table A partition(date) 
with test as (select * from table B) 
select colA as name1, colB as name2, -- correct list columns
inp_date -- partition col will be last col
from test  -- you can select from cte

刚刚找到答案,因为我的代码序列不正确。 这是代码的顺序,最后它起作用了。

set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;

with test_CTE as 
(select  *  from table1),

testone_CTE as
(select col1, col2, col3 from test_CTE)

insert into table mytablename partition(biz_dt)

select  col1 as name1, col2 as name2, col3 as name3 from testOne_CTE

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM