首页 > 技术文章 > hive语句的书写顺序和执行顺序

LIAOBO 2021-05-25 13:57 原文

1、hive语句的书写顺序:(从前往后)
(1)select
(2)from
(3)join on
(4) where
(5)group by
(6)having
(7)distribute by/cluster by
(8) sort by
(9) order by
(10) limit
(11) union(去重不排序)/union all(不去重不排序)

2、hive语句的执行顺序:
(1)from
(2)on
(3)join
(4)where
(5)group by
(6)having
(7)select
(8)distinct
(9)distribute by /cluster by
(10)sort by
(11) order by
(12) limit
(13) union /union all

推荐阅读