【发布时间】:2015-04-18 00:51:36
【问题描述】:
这个查询有什么问题(在 hive 中运行):
SELECT count(*) TotalCount, b.region_code
from XXX a
INNER JOIN YYY b
ON a.uid=b.uid
where a.dt = '2015-04-15'
group by b.region_code order by b.region_code
我认为它应该很简单,但我明白了:
FAILED: SemanticException [Error 10004]: Line 6:32 Invalid table alias or column reference 'b': (possible column names are: _col0, _col1)
这是 YYY 表:
hive> desc YYY;
OK
status_code int
uid string
zip_code string
keyword string
region_code bigint
dt timestamp
channel int
和XXX表:
hive> desc XXX;
OK
group_key string
category string
uid string
dt timestamp
【问题讨论】:
-
错误是说您的
YYY表不包含region_code列。如果您向我们展示您的 2 个表的表结构,它将对我们更有帮助。 -
添加了表结构