为什么配置单元在 group by 中要求我的变量?简单的情况下
Why hive is asking for my variable in group by? Simple case when
当我 运行 下面的配置单元查询时,我收到以下错误:编译语句时出错:
FAILED: SemanticException [Error 10025]: line 8:13 Expression not in GROUP BY key '50000'
配置单元查询:
SELECT
202106 as ANOMES,
count(wrin_agctd) as QTDETransacoes,
tipo_transacao,
cod_cate_cont,
wrin_nterm,
case
when wrin_valor<50000 then '<500'
when wrin_valor<100000 then '<1000'
when wrin_valor<150000 then '<1500'
when wrin_valor<200000 then '<2000'
end as test
FROM
ghp00468.raultav_saque_conta_salario_tecban_202106
WHERE
tipo_transacao="SAQUE_TECBAN" and
tipo_transacao="CONSULTA_TECBAN"
GROUP BY
tipo_transacao,
cod_cate_cont,
wrin_nterm;
哪里出了问题,出了什么问题?
问题是你的案例陈述。列 test
不在 group by 语句中。您应该将案例陈述添加到分组依据中,或者在分组依据外部处理它。
当我 运行 下面的配置单元查询时,我收到以下错误:编译语句时出错:
FAILED: SemanticException [Error 10025]: line 8:13 Expression not in GROUP BY key '50000'
配置单元查询:
SELECT
202106 as ANOMES,
count(wrin_agctd) as QTDETransacoes,
tipo_transacao,
cod_cate_cont,
wrin_nterm,
case
when wrin_valor<50000 then '<500'
when wrin_valor<100000 then '<1000'
when wrin_valor<150000 then '<1500'
when wrin_valor<200000 then '<2000'
end as test
FROM
ghp00468.raultav_saque_conta_salario_tecban_202106
WHERE
tipo_transacao="SAQUE_TECBAN" and
tipo_transacao="CONSULTA_TECBAN"
GROUP BY
tipo_transacao,
cod_cate_cont,
wrin_nterm;
哪里出了问题,出了什么问题?
问题是你的案例陈述。列 test
不在 group by 语句中。您应该将案例陈述添加到分组依据中,或者在分组依据外部处理它。