![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hive
kane0409
这个作者很懒,什么都没留下…
展开
-
hive中hql语法总结
1.建库语句: CREATE DATABASE [IF NOT EXISTS] database_name [COMMENT database_comment] [LOCATION hdfs_path] [WITH DBPROPERTIES (property_name=property_value, ...)]; 例: cr...原创 2019-04-25 17:21:34 · 1401 阅读 · 0 评论 -
窗口函数使用总结
窗口函数:1.什么时候用开窗函数?开窗函数常结合聚合函数使用,一般来讲聚合后的行数要少于聚合前的行数,但是有时我们既想显示聚集前的数据,又要显示聚集后的数据,这时我们便引入了窗口函数.例如:+-------+-------------+-------+---------------+--+| name | orderdate | cost | sum_window_0 ...原创 2019-04-25 17:23:58 · 941 阅读 · 0 评论 -
开窗函数中的order by导致数据不同
使用环境为hive,over()开窗函数前分排序函数和聚合函数两种。当为排序函数,如row_number(),rank()等时,over中的order by只起到窗口内排序作用。当为聚合函数,如max,min,count等时,over中的order by不仅起到窗口内排序,还起到窗口内从当前行到之前所有行的聚合。如:select id, dept, salary, min(salary...原创 2019-09-25 10:55:02 · 2634 阅读 · 0 评论