一 ,数学函数 :round,ceil,floor

1 ,四舍五入 : round

hive> select round(1.64567,2);
1.65

2 ,向上取整,向下取整 :ceil ,floor

hive> select floor(1.6);
1
hive> select ceil(1.6);
2

3 ,四舍五入到百位 : round -2

hive> select round(356789.64567,-2);
356800

二 ,字符串函数 :

1 ,大写 :upper

hive> select upper("asAsd");
ASASD

2 ,小写 :lower

hive> select lower("asAsd");
asasd

3 ,长度 :length

hive> select length("asAsd");
5

4 ,拼接 :||

hive> select "aa"||"bb"||"cc"||"dd";
aabbccdd

5 ,截取子串 :

hive> select substr("123456789",3,2);
34

6 ,去掉前后空格 :

hive> select trim("  23  56  ");
23  56

三 ,转换函数 :

1 ,cast :

hive> select cast("12" as int);
12

四 ,日期函数 :

1 ,当前时间戳 : 毫秒数

hive> select unix_timestamp();
1576389503

2 ,时间撮 --> 字符串 :

hive> select from_unixtime(1576389503,'yyyy-MM-dd HH:mm:ss');
2019-12-15 05:58:23

3 ,字符串 --> 时间撮 :

select unix_timestamp('2019-06-29 05:24:18', 'yyyy-MM-dd HH:mm:ss');

4 ,当前日期 : 精确到毫秒

hive> SELECT current_timestamp();
2019-12-15 06:06:35.134

5 ,当前日期 : 精确到秒

hive> SELECT substr(current_timestamp(),0,19);
2019-12-15

6 ,当前日期 : 精确到天

hive> select current_date;
2019-12-15