with cte AS ( SELECT cust_id, COUNT(cust_id) OVER (PARTITION BY cust_id) cnt,collect(named_struct('id', concat(cast(split(acct_id,'_')[0] as string),"_",acct_type),'name', cast(acct_name as string))) as acct_list
FROM table_name1
)
INSERT INTO table table_staging
select cust_id,acct_list
FROM cte
WHERE cnt >=1 ;
插入查询的位置是否正确?它说-无法识别“g”附近的输入在语句中选择“cust\u id”它还显示以下错误有时在更正一些东西时语义异常[error 10011]:行1:89无效函数“collect”
1条答案
按热度按时间yzuktlbb1#
你的语法很好。Hive接受CTE
INSERT
语句,在INSERT
就像一个SELECT
.但是,没有
collect()
功能。想必你打算collect_set()
或者collect_list()
.