未能将窗口调用拆分为组错误:org.apache.hadoop.hive.ql.parse

4nkexdtk  于 2021-05-29  发布在  Hadoop
关注(0)|答案(2)|浏览(599)

我正在尝试连接两个表中的两列,以生成一列的唯一id.max列值和另一个表的行号。

select (MAX(S.m_id))from MPPO S;
select row_number() OVER(ORDER BY G.a,G.r,G.f1,STG.filler2,G.n_p,G.fe,G.se) 
FROM mmp G
LEFT OUTER JOIN mppo S
ON TRIM(G.pc) = S.pc;

但当结合这两个查询时,如下所示:

select (MAX(S.m_id))+ row_number() OVER(ORDER BY G.a,G.r,G.f1,STG.filler2,G.n_p,G.fe,G.se) 
FROM mmp G LEFT OUTER JOIN mppo S
ON TRIM(G.pc) = S.pc;

我得到以下错误:

SemanticException Failed to breakup Windowing invocations into Groups. At least 1 group
must only depend on input columns. Also check for circular dependencies. Underlying error:
org.apache.hadoop.hive.ql.parse.SemanticException

我做错什么了?请帮忙

js81xvg6

js81xvg61#

分别从每个表中选择id,然后连接输出:

select concat(t.id,'',t1.id) from (select MAX(S.m_id) as id from MPPO s) t join (
select row_number() OVER(ORDER BY G.a,G.r,G.f1,STG.filler2,G.n_p,G.fe,G.se)  as id
FROM mmp G
LEFT OUTER JOIN mppo S
ON TRIM(G.pc) = S.pc) t1 on 1=1
uemypmqf

uemypmqf2#

我在 hive 里也有类似的问题。我想分享我的经验,以防有人有类似的问题
select语句具有以下分区子句

COUNT () OVER (PARTITION BY mc.source_well_key, mc.report_dt order by mc.report_dt ) AS r_number

正确的语法是

replace count() with count(1) or count(*)

相关问题