Hive数学函数

round : 四舍五入

ceil : 向下取整

floor : 向上取整

select round(45.926,2),round(45.926,1),round(45.926,0),round(45.926,-1),round(45.926,-2);

Hive字符函数

select lower('Hello World'), upper('Hello World');
select length('Hello World'),length('你好');
select concat('Hello','World');
select substr('Hello World',3);
select substr('Hello World',3,4);
select lpad('abc',10,'*'),lpad('abc',10,'*');

Hive收集函数和转换函数

size
cast
select size(map(1,'Tom',2,'Mary'));
select cast(1 as bigint);
select cast(1 as float);
select cast('2015-04-10' as date);

Hive日期函数

to_date
year
month
day
weekofyear
datediff
date_add
date_sub

Hive条件函数

coalesce:从左到右返回第一个不为null的值。
case... when...:
case a when b then c [when d then e]* [else if] end
i.e.
select ename,job,sal,
case job when 'persident' then sal+1000,
when 'manager' then sal+800,
else sal+400
end
from emp;

Hive聚合函数和表生成函数

聚合函数 countsumminmaxavg
表生成函数 explode
select count(*),sum(sal),max(sal),min(sal),avg(sal) from emp;
select explode(map(1,'Tom',2,'Mary',3.'Mike'));

Hive进阶_内置函数的更多相关文章

  1. Python进阶(五)----内置函数Ⅱ 和 闭包

    Python进阶(五)----内置函数Ⅱ 和 闭包 一丶内置函数Ⅱ ####内置函数#### 特别重要,反复练习 ###print() 打印输入 #sep 设定分隔符 # end 默认是换行可以打印到 ...

  2. python开发函数进阶:内置函数

    一,内置函数 #内置的模块#拿过来直接就用的:内置的函数 #!/usr/bin/env python #_*_coding:utf-8_*_ #内置的模块 #拿过来直接就用的:内置的函数 #作用域相关 ...

  3. Hive(七)【内置函数】

    目录 一.系统内置函数 1.查看系统自带内置函数 2.查看函数的具体用法 二.常用内置函数 1.数学函数 round 2.字符函数 split concat concat_ws lower,upper ...

  4. python成长之路第三篇(3)_内置函数及生成器迭代器

    打个广告欢迎加入linux,python资源分享群群号:478616847 目录: 1.lambda表达式 2.map内置函数 3.filter内置函数 4.reduce内置函数 5.yield生成器 ...

  5. python之路:进阶篇 内置函数

     li = [11, 22, 33] news = map(  li = [100, 2200, 3300] news = map(  [13, 24, 35] [11, 11, 11] [22, 4 ...

  6. python基础12_匿名_内置函数

    一个二分查找的示例: # 二分查找 示例 data = [1, 3, 6, 7, 9, 12, 14, 16, 17, 18, 20, 21, 22, 23, 30, 32, 33, 35, 36, ...

  7. Python基础(10)_内置函数、匿名函数、递归

    一.内置函数 1.数学运算类 abs:求数值的绝对值 divmod:返回两个数值的商和余数,可用于计算页面数 >>> divmod(5,2) (2, 1) max:返回可迭代对象中的 ...

  8. Python进阶-VII 内置函数

    一.内置函数引入 我们已经了解的有; print()  input() range() next()  dir() str() int() list() set() tuple() dict() he ...

  9. Python笔记(二十一)_内置函数、内置方法

    内置函数 issubclass(class1,class2) 判断class1类是否为class2类的子类,返回True和False 注意1:类会被认为是自身的子类 >>>issub ...

随机推荐

  1. JS遍历获取多个控件(使用索引‘i’)

    1.n个tid="n1"的input.n个tid="n2"的input.n个tid="n3"的input---循环遍历 ; i <= ...

  2. dynamic 作为参数传入另一个程序集,获取值

    dynamicOBJ.GetType().GetProperty("key").GetValue(dynamicOBJ, null)

  3. P2762 [网络流24题]太空飞行计划问题(最小割)

    地址 最大权闭合子图裸题,不说了吧,求方案就是把s集遍历一遍. 错误记录:dfs那块忘判断残量了,11分×1. #include<cstdio> #include<iostream& ...

  4. hdu3739 Anti LIS[最小割]

    长度为 n≤1000 的数列 ai,其中最长上升子序列的长度为 s.至少删去多少数使得最长上升子序列的长度小于 s. 其实这题和那个求有多少不重叠LIS是一样答案的. 先放个图. 图丑别说我. 原网络 ...

  5. 1067 Bash 游戏v2

    传送门 1067 Bash游戏 V2 基准时间限制:1 秒 空间限制:131072 KB 分值: 10   有一堆石子共有N个.A B两个人轮流拿,A先拿.每次只能拿1,3,4颗,拿到最后1颗石子的人 ...

  6. 【Lintcode】046.Majority Number

    题目: Given an array of integers, the majority number is the number that occurs more than half of the ...

  7. /etc/bashrc和/etc/profile

    在一般的 linux 或者 unix 系统中, 都可以通过编辑 bashrc 和 profile来设置用户的工作环境, 很多文章对于 profile 和 bashrc 也都有使用, 但究竟每个文件都有 ...

  8. 6 git 生成SSH公钥/私钥 查看公钥

    如果没有公钥的话就生成公钥私钥:  $ ssh-keygen 然后连续回车(一次是位置,两次密码)

  9. JavaScript总结(1)

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...

  10. Swiper 滑动切换图片(可用于PC端,移动端)

    作为一名后端的普通程序猿, 你让我搞这种前端不是跟我玩命吗,所以用插件来搞,省事又简单,而且Swiper使用又简单是吧: 头皮发麻,不喜欢说废话,我更喜欢直接看到效果: 按Swiper官方文档来说, ...