Hive:SELECT AS和GROUP BY [英] Hive: SELECT AS and GROUP BY

查看:2544
本文介绍了Hive:SELECT AS和GROUP BY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Hive查询,如

I have a Hive Query like

SELECT Year, Month, Day, Hours, Minutes,
           cast((cast(Seconds as int)/15) as int)*15
AS secondMod, Count(*) AS PerCount FROM LoggerTable 
 GROUP BY Year, Month, Day, Hours, Minutes, secondMod 
ORDER BY PerCount;

上述查询失败并显示错误

the above query fails with an error


FAILED:语义分析错误:第1行:175无效表别名或列引用secondMod

FAILED: Error in semantic analysis: line 1:175 Invalid Table Alias or Column Reference secondMod

' LoggerTable'是一个包含所有字符串类型列的Hive表。

'LoggerTable' is a Hive Table with all columns of string type.

这个问题的解决方法是什么?

Any workaround for this issue?

推荐答案

试试这个:

Try this:

SELECT Year, Month, Day, Hours, Minutes, 
cast((cast(Seconds as int)/15) as int)*15 
AS secondMod, Count(*) AS PerCount FROM LoggerTable 
 GROUP BY Year, Month, Day, Hours, Minutes, 
   cast((cast(Seconds as int)/15) as int)*15
ORDER BY PerCount;

这篇关于Hive:SELECT AS和GROUP BY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆