【问题标题】:Hive: Invalid Column ReferenceHive:无效的列引用
【发布时间】:2014-04-02 13:23:15
【问题描述】:

在 Hive 中,我有四个表:

  • temp_basic_info(ID、MSISDN、GENDER、AGE、DAY、MONTH、YEAR、RELATIONSHIPSTATUS)
  • temp_education(ID,EDUCATION)
  • likes_and_music(ID、NAME、PAGE)
  • temp_output(ID、MSISDN、GENDER、AGE、DAY、MONTH、YEAR、RELATIONSHIPSTATUS、EDUCATION、LIKES_AND_PREFERENCES)

temp_output 为空。

现在,我想将其他三个表中的相应字段传输到 temp_output。 likes_and_music 有多个相同 ID 的实例,与不同的 NAME 和 PAGE 配对,所以我必须将它们放在一个数组中。

我的预计输出如下所示:

0001 msisdn1 male 21 1 2 92 0 College [Jeep, soccer, PC games, etc...]

到目前为止,这是我的查询:

Select a.ID, a.MSISDN, a.GENDER, a.AGE, a.DAY, a.MONTH, a.YEAR, a.RELATIONSHIPSTATUS, b.EDUCATION, COLLECT_SET(c.NAME) FROM temp_basic_info a JOIN temp_education b ON (a.ID = b.ID) JOIN likes_and_music c ON (c.ID = b.ID) GROUP BY a.ID, a.MSISDN, a.GENDER, a.AGE, a.DAY, a.MONTH, a.YEAR, a.RELATIONSHIPSTATUS, b.EDUCATION, c.name limit 10;

但后者返回如下错误:

失败:SemanticException [错误 10002]:第 1:311 行无效的列引用“教育”

我错过了什么?

【问题讨论】:

  • 可以通过添加没有likes_and_music表记录的记录来检查吗?

标签: sql hadoop hive


【解决方案1】:
temp_education (ID, NAME)

我没有看到表 temp_education b 的列 b.education

【讨论】:

  • 哦,对不起,这是一个错字。应该是(ID,EDUCATION)
猜你喜欢
  • 1970-01-01
  • 2023-03-30
  • 2013-03-12
  • 1970-01-01
  • 2016-05-01
  • 2021-09-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多