标签:
返回类型
|
函数
|
说明
|
BIGINT
|
round(double a)
|
四舍五入
|
DOUBLE
|
round(double a, int d)
|
小数部分d位之后数字四舍五入,例如round(21.263,2),返回21.26
|
BIGINT
|
floor(double a)
|
对给定数据进行向下舍入最接近的整数。例如floor(21.2),返回21。
|
BIGINT
|
ceil(double a), ceiling(double a)
|
将参数向上舍入为最接近的整数。例如ceil(21.2),返回23.
|
double
|
rand(), rand(int seed)
|
返回大于或等于0且小于1的平均分布随机数(依重新计算而变)
|
double
|
exp(double a)
|
返回e的n次方
|
double
|
ln(double a)
|
返回给定数值的自然对数
|
double
|
log10(double a)
|
返回给定数值的以10为底自然对数
|
double
|
log2(double a)
|
返回给定数值的以2为底自然对数
|
double
|
log(double base, double a)
|
返回给定底数及指数返回自然对数
|
double
|
pow(double a, double p) power(double a, double p)
|
返回某数的乘幂
|
double
|
sqrt(double a)
|
返回数值的平方根
|
string
|
bin(BIGINT a)
|
|
string
|
hex(BIGINT a) hex(string a)
|
将整数或字符转换为十六进制格式。参考:http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_hex
|
string
|
unhex(string a)
|
十六进制字符转换由数字表示的字符。
|
string
|
conv(BIGINT num, int from_base, int to_base)
|
将指定数值,由原来的度量体系转换为指定的试题体系。例如CONV(‘a’,16,2),返回。参考:’1010′ http://dev.mysql.com/doc/refman/ ... .html#function_conv
|
double
|
abs(double a)
|
取绝对值
|
int double
|
pmod(int a, int b) pmod(double a, double b)
|
返回a除b的余数的绝对值
|
double
|
sin(double a)
|
返回给定角度的正弦值
|
double
|
asin(double a)
|
返回x的反正弦,即是X。如果X是在-1到1的正弦值,返回NULL。
|
double
|
cos(double a)
|
返回余弦
|
double
|
acos(double a)
|
返回X的反余弦,即余弦是X,,如果-1<= A <= 1,否则返回null.
|
int double
|
positive(int a) positive(double a)
|
返回A的值,例如positive(2),返回2。
|
int double
|
negative(int a) negative(double a)
|
返回A的相反数,例如negative(2),返回-2。
|
返回类型
|
函数
|
说明
|
int
|
size(Map<K.V>)
|
返回的map类型的元素的数量
|
int
|
size(Array<T>)
|
返回数组类型的元素数量
|
返回类型
|
函数
|
说明
|
指定 “type”
|
cast(expr as <type>)
|
类型转换。例如将字符”1″转换为整数:cast(’1′ as bigint),如果转换失败返回NULL。
|
返回类型
|
函数
|
说明
|
string
|
from_unixtime(bigint unixtime[, string format])
|
UNIX_TIMESTAMP参数表示返回一个值’YYYY- MM – DD HH:MM:SS’或YYYYMMDDHHMMSS.uuuuuu格式,这取决于是否是在一个字符串或数字语境中使用的功能。该值表示在当前的时区。
|
bigint
|
unix_timestamp()
|
如果不带参数的调用,返回一个Unix时间戳(从’1970- 01 – 0100:00:00′到现在的UTC秒数)为无符号整数。
|
bigint
|
unix_timestamp(string date)
|
指定日期参数调用UNIX_TIMESTAMP(),它返回参数值’1970- 01 – 0100:00:00′到指定日期的秒数。
|
bigint
|
unix_timestamp(string date, string pattern)
|
指定时间输入格式,返回到1970年秒数:unix_timestamp(’2009-03-20′, ‘yyyy-MM-dd’) = 1237532400 参考:http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
|
string
|
to_date(string timestamp)
|
返回时间中的年月日: to_date(“1970-01-01 00:00:00″) = “1970-01-01″
|
string
|
to_dates(string date)
|
给定一个日期date,返回一个天数(0年以来的天数)
|
int
|
year(string date)
|
返回指定时间的年份,范围在1000到9999,或为”零”日期的0。
|
int
|
month(string date)
|
返回指定时间的月份,范围为1至12月,或0一个月的一部分,如’0000-00-00′或’2008-00-00′的日期。
|
int
|
day(string date) dayofmonth(date)
|
返回指定时间的日期
|
int
|
hour(string date)
|
返回指定时间的小时,范围为0到23。
|
int
|
minute(string date)
|
返回指定时间的分钟,范围为0到59。
|
int
|
second(string date)
|
返回指定时间的秒,范围为0到59。
|
int
|
weekofyear(string date)
|
返回指定日期所在一年中的星期号,范围为0到53。
|
int
|
datediff(string enddate, string startdate)
|
两个时间参数的日期之差。
|
int
|
date_add(string startdate, int days)
|
给定时间,在此基础上加上指定的时间段。
|
int
|
date_sub(string startdate, int days)
|
给定时间,在此基础上减去指定的时间段。
|
返回类型
|
函数
|
说明
|
T
|
if(boolean testCondition, T valueTrue, T valueFalseOrNull)
|
判断是否满足条件,如果满足返回一个值,如果不满足则返回另一个值。
|
T
|
COALESCE(T v1, T v2, …)
|
返回一组数据中,第一个不为NULL的值,如果均为NULL,返回NULL。
|
T
|
CASE a WHEN b THEN c [WHEN d THEN e]* [ELSE f] END
|
当a=b时,返回c;当a=d时,返回e,否则返回f。
|
T
|
CASE WHEN a THEN b [WHEN c THEN d]* [ELSE e] END
|
当值为a时返回b,当值为c时返回d。否则返回e。
|
返回类型
|
函数
|
说明
|
int
|
length(string A)
|
返回字符串的长度
|
string
|
reverse(string A)
|
返回倒序字符串
|
string
|
concat(string A, string B…)
|
连接多个字符串,合并为一个字符串,可以接受任意数量的输入字符串
|
string
|
concat_ws(string SEP, string A, string B…)
|
链接多个字符串,字符串之间以指定的分隔符分开。
|
string
|
substr(string A, int start) substring(string A, int start)
|
从文本字符串中指定的起始位置后的字符。
|
string
|
substr(string A, int start, int len) substring(string A, int start, int len)
|
从文本字符串中指定的位置指定长度的字符。
|
string
|
upper(string A) ucase(string A)
|
将文本字符串转换成字母全部大写形式
|
string
|
lower(string A) lcase(string A)
|
将文本字符串转换成字母全部小写形式
|
string
|
trim(string A)
|
删除字符串两端的空格,字符之间的空格保留
|
string
|
ltrim(string A)
|
删除字符串左边的空格,其他的空格保留
|
string
|
rtrim(string A)
|
删除字符串右边的空格,其他的空格保留
|
string
|
regexp_replace(string A, string B, string C)
|
字符串A中的B字符被C字符替代
|
string
|
regexp_extract(string subject, string pattern, int index)
|
通过下标返回正则表达式指定的部分。regexp_extract(‘foothebar’, ‘foo(.*?)(bar)’, 2) returns ‘bar.’
|
string
|
parse_url(string urlString, string partToExtract [, string keyToExtract])
|
返回URL指定的部分。parse_url(‘http://facebook.com/path1/p.php?k1=v1&k2=v2#Ref1′, ‘HOST’) 返回:’facebook.com’
|
string
|
get_json_object(string json_string, string path)
|
select a.timestamp, get_json_object(a.appevents, ‘$.eventid’), get_json_object(a.appenvets, ‘$.eventname’) from log a;
|
string
|
space(int n)
|
返回指定数量的空格
|
string
|
repeat(string str, int n)
|
重复N次字符串
|
int
|
ascii(string str)
|
返回字符串中首字符的数字值
|
string
|
lpad(string str, int len, string pad)
|
返回指定长度的字符串,给定字符串长度小于指定长度时,由指定字符从左侧填补。
|
string
|
rpad(string str, int len, string pad)
|
返回指定长度的字符串,给定字符串长度小于指定长度时,由指定字符从右侧填补。
|
array
|
split(string str, string pat)
|
将字符串转换为数组。
|
int
|
find_in_set(string str, string strList)
|
返回字符串str第一次在strlist出现的位置。如果任一参数为NULL,返回NULL;如果第一个参数包含逗号,返回0。
|
array<array<string>>
|
sentences(string str, string lang, string locale)
|
将字符串中内容按语句分组,每个单词间以逗号分隔,最后返回数组。 例如sentences(‘Hello there! How are you?’) 返回:( (“Hello”, “there”), (“How”, “are”, “you”) )
|
array<struct<string,double>>
|
ngrams(array<array<string>>, int N, int K, int pf)
|
SELECT ngrams(sentences(lower(tweet)), 2, 100 [, 1000]) FROM twitter;
|
array<struct<string,double>>
|
context_ngrams(array<array<string>>, array<string>, int K, int pf)
|
SELECT context_ngrams(sentences(lower(tweet)), array(null,null), 100, [, 1000]) FROM twitter;
|
标签:
原文地址:http://www.cnblogs.com/CRXY/p/4569406.html