Hive 查询未按预期工作

Hive query not working as expected

id                      bigint                  from deserializer   
created_at              string                  from deserializer   
source                  string                  from deserializer   
favorited               boolean                 from deserializer   
retweeted_status        struct<text:string,user:struct<screen_name:string,name:string>,retweet_count:int>   from deserializer   
entities                struct<urls:array<struct<expanded_url:string>>,user_mentions:array<struct<screen_name:string,name:string>>,hashtags:array<struct<text:string>>> from deserializer   
text                    string                  from deserializer   
user                    struct<screen_name:string,name:string,friends_count:int,followers_count:int,statuses_count:int,verified:boolean,utc_offset:int,time_zone:string,location:string>    from deserializer   
in_reply_to_screen_name string                  from deserializer   

.

select  id from election order by election.retweeted_status.retweet_count desc  limit 10

此查询无效 错误是 "SemanticException [Error 10002]: Line 1:53 Invalid column reference 'retweeted_status'"

 select  * from election order by election.retweeted_status.retweet_count desc  limit 10

但是这个查询有效

查询按以下顺序执行

1 FROM 子句

2 WHERE 子句

3 GROUP BY 子句

4 HAVING 子句

5 SELECT 条款

6 ORDER BY 子句

7 限制

因为在我们从 select 子句获得结果集后执行订单,因为您没有 selected 列在 select 子句中 orderby 子句将无法找到列引用执行操作。