版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lyzx_in_csdn/article/details/85643018
19 abs
20 acos
21 add_months add_months(start_date, num_months) - Returns the date that is num_months after start_date.
>> SELECT add_months(to_date('2019-01-31'),1) => 2019-02-28
22 and a1 and a2 and ... and an - Logical and
>> SELECT true and true => true
>> SELECT true and false => false
23 array array(n0, n1...) - Creates an array with the given elements
>> SELECT array(1,2,3) as arr => [1,2,3] 返回一个数组
24 array_contains array_contains(array, value) - Returns TRUE if the array contains value
>> SELECT array_contains(array(1,2,3),21) =>false
>> SELECT array_contains(array(1,2,3),2) =>true
25 ascii ascii(str) - returns the numeric value of the first character of str
>> SELECT ascii('1') => 49
>> SELECT ascii('你') => -28
26 asin
27 assert_true assert_true(condition) - Throw an exception if 'condition' is not true
>> SELECT assert_true(true) => NULL
>> SELECT assert_true(FALSE) => 抛异常
28 atan
29 avg
30 base64
31 between
32 bin bin(n) - returns n in binary
>> SELECT BIN(99) =>1100011
33 bround bround(x[, d]) - round x to d decimal places using HALF_EVEN rounding mode
>> 不清楚和round的区别
34 case CASE a WHEN b THEN c [WHEN d THEN e]* [ELSE f] END - When a = b, returns c; when a = d, return e; else return f
35 cbrt cbrt(double) - Returns the cube root of a double value. 返回一个double类型的立方根,当然也可以是整形的立方根
>> SELECT cbrt(27.09) => 3.003329636473136
>> SELECT cbrt(27) => 3
36 ceil ceil(x) - Find the smallest integer not smaller than x 找到一个大于x的最小整形,向上(大)取整数
>> SELECT ceil(28.99) => 29
>> SELECT ceil(-28.99) => -28
37 ceiling ceiling(x) - Find the smallest integer not smaller than x
38 chr chr(str) - convert n where n : [0, 256) into the ascii equivalent as a varchar.If n is less than 0 return the empty string. If n > 256, return chr(n % 256).
>> 返回参数的ascii码值 和 ascii整好相反
>> SELECT chr("49") <==> 1 <==> SELECT ascii('1')
39 coalesce coalesce(a1, a2, ...) - Returns the first non-null argument 返回第一个非空值
>> SELECT coalesce(null,"A","B") => "A"
>> SELECT coalesce(array(null,"A","B")) => array(null,"A","B")
40 collect_list collect_list(x) - Returns a list of objects with duplicates
41 collect_set collect_set(x) - Returns a set of objects with duplicate elements eliminated
t2.id t2.catalog
1 AA
1 BB
2 CC
2 DD
>> select id,concat('["',concat_ws('","',collect_set(catalog)),'"]') from t2 group by id
id _c1
1 ["AA","BB"]
2 ["CC","DD"]
42 compute_stats compute_stats(x) - Returns the statistical summary of a set of primitive type values
43 concat concat(str1, str2, ... strN) - returns the concatenation of str1, str2, ... strN or concat(bin1, bin2, ... binN) - returns the concatenation of bytes in binary data bin1, bin2, ... binN
>> SELECT concat('-','A','Z') => -AZ
44 concat_ws concat_ws(separator, [string | array(string)]+) - returns the concatenation of the strings separated by the separator
>> SELECT concat_ws('-',array("A","B","C")) =>A-B-C
>> SELECT concat_ws('-',array("A","B","C"),array("X","Y","Z")) =>A-B-C-X-Y-Z
>> SELECT concat_ws('-','A','Z') =>A-Z
45 context_ngrams context_ngrams(expr, array<string1, string2, ...>, k, pf) estimates the top-k most frequent n-grams that fit into the specified context. The second parameter specifies a string of words that specify the positions of the n-gram elements, with a null value standing in for a 'blank' that must be filled by an n-gram element.
sencenses sentences(str,lang,country) - Splits str into arrays of sentences,where each sentence is an array of words. The 'lang' and'country' arguments are optional, and if omitted, the default locale is used
切割一个句子到一个数组,每句话放入到一个数组,lang(语系)和country(国家)参数是可选的,如果不写就默认使用本地语系和国家,返回值是 Array(Array(string),Array(string),Array(string))
>> SELECT sentences('aa bb ccrr! hello world! hello china! 啊啊! 888! 123') => [["aa","bb","ccrr"],["hello","world"],["hello","china"],["啊啊"],["888"],["123"]]
>> 其实按照标点符号切分每句话,一句话放入一个数组中,每句话按照空格切分为多个单词
46 conv conv(num, from_base, to_base) - convert num from from_base to to_base 进制转换
>> SELECT conv(11,10,16) =>B 把10进制的11转换为16进制
47 corr corr(x,y) - Returns the Pearson coefficient of correlation
48 cos
49 count
50 covar_pop
51 covar_samp
52 crc32
53 create_union create_union(tag, obj1, obj2, obj3, ...) - Creates a union with the object for given tag
54 cume_dist
55 current_database
56 current_date
57 current_timestamp
>> SELECT current_timestamp() => 2019-01-02 20:41:14.514
>> SELECT date_format(current_timestamp(),'yyyy-MM-dd HH:mm:ss') => 2019-01-02 20:40:28
58 current_user current_user() - Returns current user name
>> SELECT current_user() => liyaohui
59 date_add date_add(start_date, num_days) - Returns the date that is num_days after start_date.
>> SELECT date_add(to_date('2018-12-10'),22) =>2019-01-01
60 date_format date_format(date/timestamp/string, fmt) - converts a date/timestamp/string to a value of string in the format specified by the date format fmt
>> SELECT date_format(to_date('2018-12-10'),'yyyy/MM/dd') =>2018/12/10