hive函数
来源:互联网 发布:淘宝客算销量吗 编辑:程序博客网 时间:2024/06/09 21:53
###一、数据函数
###二、字符函数
###三、收集函数和转换函数
3.1、收集函数格式:
size(map(<key, value>, <key, value>));
范例:
hive> select size(map(1, 'a', 2, 'b'));OK2Time taken: 0.79 seconds, Fetched: 1 row(s)hive>
3.2、转换函数格式
将莫个数据按照某种格式转化
hive> select cast(1 as float);OK1.0Time taken: 0.648 seconds, Fetched: 1 row(s)hive>
四、日期函数
4.1、to_date: 从一个字符串中获取日期,注意:必须以日期开头
####4.2、year, month, day
hive> select year('2017-12-15'), month('2017-12-15'), day('2017-12-15');OK2017 12 15Time taken: 0.729 seconds, Fetched: 1 row(s)hive>
4.3、weekofyear:一年的第几周
hive> select weekofyear('2017-12-15') ;OK50Time taken: 0.624 seconds, Fetched: 1 row(s)hive>
4.4、datediff: 两个日期相差多少天
hive> select datediff('2017-12-15', '2017-12-13');OK2Time taken: 0.64 seconds, Fetched: 1 row(s)hive> hive> select datediff('2017-12-15 13:45', '2017-12-13 12:30');OK2Time taken: 0.679 seconds, Fetched: 1 row(s)hive> select datediff('2017-12-15 13:45:23', '2017-12-13 12:30:23');OK2Time taken: 0.634 seconds, Fetched: 1 row(s)hive>
4.4、date_add, date_sub;
日期增加函数: date_add语法: date_add(string startdate, int days)
返回值: string
说明: 返回开始日期startdate增加days天后的日期。
举例:
hive> select date_add(‘2012-12-08’,10) from dual;
2012-12-18
日期减少函数: date_sub语法: date_sub (string startdate, int days)
返回值: string
说明: 返回开始日期startdate减少days天后的日期。
举例:
hive> select date_sub(‘2012-12-08’,10) from dual;
2012-11-28
阅读全文
0 0
- #HIVE#hive函数参考手册
- hive - Hive函数大全
- hive函数
- Hive函数
- hive 函数
- Hive-函数
- hive函数
- HIVE函数
- Hive函数
- hive函数
- Hive函数
- Hive函数
- hive函数
- hive 函数
- hive 函数
- hive 函数
- hive函数
- Hive(十二)--Hive函数大全
- Linux发行版进化史
- 【Sublime】设置 sublime Text3 中的 Tab 键为 4 个空格
- Linux shell example
- 基于canvas使用粒子拼出你想要的文字[2]——粒子的动画效果
- codeforces 479A Expression
- hive函数
- zookeeper启动过程函数调用
- 2017.12.18 LeetCode
- Jenkins轮询目录设置
- EditPlus等编辑器选中列(块)的方法
- JMS(二)--ActiveMQ简单介绍以及安装
- 【scala 数据结构和算法】Scala实现:快速排序
- 算法时间复杂度与空间复杂度
- 软件缺陷的正式定义