- impala使用UDF函数需要注册
create function md5(string) returns string location ‘hdfs://nameservice/user/impala/user_function/MyHiveUDF.jar’ symbol=‘com.business.bi.udf.MD5’;
SQL说明:
md5(string) returns string 注册的方法名为md5,输入参数类型为string,返回值类型为string
location ‘hdfs://nameservice/user/impala/user_function/MyHiveUDF.jar’ UDF方法的jar包位置
symbol=‘com.business.bi.udf.MD5’ 自定义UDF的类名 - 查看impala支持的函数
use _impala_builtins;
show functions;
字符函数
SELECT ASCII(‘a’) ;
SELECT CHAR_LENGTH(“RUNOOB”) AS LengthOfString;
SELECT CHARACTER_LENGTH(“RUNOOB”) AS LengthOfString;
SELECT CONCAT("SQL ", “Runoob “, “Gooogle “, “Facebook”) AS ConcatenatedString;
SELECT CONCAT_WS(”-”, “SQL”, “Tutorial”, “is”, “fun!”)AS ConcatenatedString;
SELECT FIND_IN_SET(“c”, “a,b,c,d,e”);
SELECT LOCATE(‘st’,‘myteststring’);
SELECT LOCATE(‘b’, ‘abc’);
SELECT LCASE(‘RUNOOB’)
SELECT LEFT(‘runoob’,2)
SELECT LOWER(‘RUNOOB’)
SELECT LPAD(‘abc’,5,‘xx’)
SELECT LTRIM(” RUNOOB”) AS LeftTrimmedString;
SELECT REPEAT(‘runoob’,3)
SELECT REPLACE(‘abc’,‘a’,‘x’)
SELECT REVERSE(‘abc’)
SELECT RIGHT(‘runoob’,2)
SELECT RPAD(‘abc’,5,‘xx’)
SELECT RTRIM("RUNOOB ") AS RightTrimmedString;
SELECT SPACE(10);
SELE