hive中sql执行顺序

1.from 

2.join on 或 lateral view explode(需炸裂的列)  tbl   as  炸裂后的列名

3.where

4.group by  (开始使用select中的别名,从group 开始往后都可用)

5.聚合函数 如Sum()  avg()  count(1)等

6.having

7.select  中若包含over()开窗函数,执行完非开窗函数后select等待执行完开窗函数,然后执行select完,开窗函数通过表数据进行分区和排序,跟select查询中的字段是平行关系,不依赖查询字段。

8.distinct

9.order by 

猜你喜欢

转载自www.cnblogs.com/sunpengblog/p/11322170.html