以下代码给出以下错误:
(失败:SemanticException无法将窗口调用分解为组。至少1个组必须仅取决于输入列。还要检查循环依赖性。 基本错误:org.apache.hadoop.hive.ql.parse.SemanticException:行7:13无效的表别名或列引用'dlr_prct':)
SELECT
OD.BAC,
OD.COUNTRY_CD,
LOD.LABOR_OPERATION_CD AS LOD,
T2.max_hr_cnt as max_hr_cnt,
cast ((max_hr_cnt) as decimal (15, 3)) * 1.0 / cast ((T2.Total) as
decimal (15, 3)) as dlr_prct,
avg (dlr_prct) OVER (PARTITION BY OD.COUNTRY_CD, OD.BAC, T2.LOD) as
avg_dlr_pct,
STDDEV_POP (dlr_prct) OVER (PARTITION BY OD.COUNTRY_CD, OD.BAC, T2.LOD)
as std_dlr_pct,
(dlr_prct - avg_dlr_pct ) / NULLIFZERO (std_dlr_pct)
as RI_WTY_11
From
schema_name.Claim_fact Cf
LEFT JOIN
schema_name.LABOR_OPERATION_DIM LOD
ON LOD.LABOR_OPERATION_KEY = Cf.LABOR_OPERATION_KEY
LEFT JOIN
schema_name.CLAIM_DIM CLM_D
ON CLM_D.CLAIM_DIM_KEY = Cf.CLAIM_DIM_KEY
LEFT JOIN
schema_name.Claim_Search_Dim CSD
ON csd.Claim_Search_Key = cf.Claim_Search_Key
LEFT JOIN
schema_name.Organization_DIM OD
ON OD.Organization_Key = csd.Repairing_Service_Agent_Key
left join
(
SELECT
OD.COUNTRY_CD,
OD.BAC,
LOD.LABOR_OPERATION_CD AS LOD,
t1.Total,
count(*) as max_hr_cnt
from
schema_name.Claim_fact Cf
LEFT JOIN
schema_name.LABOR_OPERATION_DIM LOD
ON LOD.LABOR_OPERATION_KEY = Cf.LABOR_OPERATION_KEY
LEFT JOIN
schema_name.CLAIM_DIM CLM_D
ON CLM_D.CLAIM_DIM_KEY = Cf.CLAIM_DIM_KEY
LEFT JOIN
schema_name.Claim_Search_Dim CSD
ON csd.Claim_Search_Key = cf.Claim_Search_Key
LEFT JOIN
schema_name.Organization_DIM OD
ON od.Organization_Key = csd.Repairing_Service_Agent_Key
LEFT join
(
select
OD.COUNTRY_CD,
OD.BAC,
LOD.LABOR_OPERATION_CD AS LOD,
Cf.TOTAL_LABOR_HOURS,
MAX(Cf.TOTAL_LABOR_HOURS) * 0.95 AS hrs,
count (*) as Total
FROM
schema_name.Claim_fact Cf
LEFT JOIN
schema_name.LABOR_OPERATION_DIM LOD
ON LOD.LABOR_OPERATION_KEY = Cf.LABOR_OPERATION_KEY
LEFT JOIN
schema_name.CLAIM_DIM CLM_D
ON CLM_D.CLAIM_DIM_KEY = Cf.CLAIM_DIM_KEY
LEFT JOIN
schema_name.Claim_Search_Dim CSD
ON csd.Claim_Search_Key = cf.Claim_Search_Key
LEFT JOIN
schema_name.Organization_DIM OD
ON od.Organization_Key =
strong textcsd.Repairing_Service_Agent_Key
group by
COUNTRY_CD,
BAC,
LABOR_OPERATION_CD,
TOTAL_LABOR_HOURS
)as T1
on LOD.LABOR_OPERATION_CD = T1.LOD
and OD.BAC = T1.BAC
where
Cf.TOTAL_LABOR_HOURS
> 0.95* T1.hrs
group by
OD.COUNTRY_CD,
OD.BAC,
LOD.LABOR_OPERATION_CD,
T1.Total
)
as T2
On T2.LOD = LOD.LABOR_OPERATION_CD
and OD.BAC = T2.BAC
and OD.COUNTRY_CD = T2.COUNTRY_CD;