select * from `_Followee` 
where `user.objectId` 
in (select `followee.objectId` from `_Followee` where `user.objectId` = '557f9ba4e4b0a83febdd2f2a')

类似这样的查询支持吗?在做 in 查询的时候,为什么会报错?

select * from `_Followee` 
where `user.objectId` 
in ('557f9ba4e4b0a83febdd2f2a')

这样的查询就可以,为什么?

你先把错误信息贴出来吧

Error: missing EOF at 'as' near ')'; line 3 pos 100

你试试在子查询后面加上 as,也就是给子查询一个别名。

select * from _Followee 
where user.objectId 
in (select followee.objectId from _Followee where user.objectId = '557f9ba4e4b0a83febdd2f2a') as temptable

给了别名之后: Error: missing EOF at 'as' near ')'; line 3 pos 100

刚好是 as 位置

select * from _Followee 
where user.objectId 
in (select followee.objectId  as objectId from _Followee where user.objectId = '557f9ba4e4b0a83febdd2f2a')

Unsupported language features in query: select * from _Followee where user.objectId in (select followee.objectId as objectId from _Followee where user.objectId = '557f9ba4e4b0a83febdd2f2a') TOK_QUERY 1, 0,36, 14 TOK_FROM 1, 4,6, 14

那应该不能解决了,因为语法是由 Hive 定义的。不过你这里直接这样写也能查出来:

select * from `_Followee` where user.objectId = '557f9ba4e4b0a83febdd2f2a'

但是 Hive 是支持 in 查询的啊

As of Hive 0.13 some types of subqueries are supported in the WHERE clause.

在 where 子句里面使用子查询是从 Hive 0.13 开始支持的,我们的系统是基于依赖 Hive 的 Spark SQL 的,问题应该在于我们目前使用的 Spark SQL 依赖的 Hive 版本为 0.12.0,也就是暂不支持上述特性。

后面有升级计划吗?

会有升级,但是考虑到系统的稳定性,时间节点暂时不确定。