Impala 字符串函数详解

impala 3.2版本

1.ASCII(STRING str)  

  CHR(INT character_code)

 

2.BASE64DECODE(STRING str)  -- 使用获取字符串的信息

 BASE64ENCODE(STRING str) --使用BASE64 进行字符串加密

 

3.BTRIM LTRIM RTRIM TRIM 

4.字符串拼接函数

CONCAT(STRING a, STRING b...)

CONCAT_WS(STRING sep, STRING a, STRING b...)

GROUP_CONCAT(STRING s [, STRING sep])

select concat('[',btrim('xy    hello zyzzxx','xyz'),']') arr,   concat('[',trim(btrim('xy    hello zyzzxx','xyz')),']');

 5. 字符串长度:

CHAR_LENGTH  LENGTH  LEVENSHTEIN, LE_DST
CHAR_LENGTH Aliases for the length()

6.字符串大小写:

INITCAP  LOWER, LCASE  UPPER, UCASE

7.字符串截取:

LEFT  RIGHT STRRIGHT STRLEFT SUBSTR, SUBSTRING
LEFT(STRING a, INT num_chars)

8.字符串填充:

LPAD  RPAD

9.字符串定位:

FIND_IN_SET  LOCATE  INSTR

INSTR(STRING str, STRING substr [, BIGINT position [, BIGINT occurrence ] ])
Returns the position (starting from 1) of the first occurrence of a substr within a longer string.
LOCATE(STRING substr, STRING str[, INT pos])
  Returns the position (starting from 1) of the first occurrence of a substring within a longer string, 
optionally after a particular position.
FIND_IN_SET(STRING str, STRING strList)
Purpose: Returns the position (starting from 1) of the first occurrence of a specified string within a 
comma-separated string. Returns NULL if either argument is NULL, 0 if the search string is not found, 
or 0 if the search string contains a comma.

 10.URL解析函数:

PARSE_URL
PARSE_URL(STRING urlString, STRING partToExtract [, STRING keyToExtract])
The part argument can be 'PROTOCOL', 'HOST', 'PATH', 'REF', 'AUTHORITY', 'FILE', 'USERINFO', or 'QUERY'.

11.正则表达式函数:

REGEXP_ESCAPE
REGEXP_EXTRACT
REGEXP_LIKE
REGEXP_REPLACE

12. 字符串切割函数:

SPLIT_PART(STRING source, STRING delimiter, BIGINT n)

13.字符其他操作:

REPEAT  -- 字符串重复
REPLACE --字符串替换操作
REVERSE --字符串反转操作
SPACE   --添加空格操作
TRANSLATE --字符串翻译

14. impala 3.2 版本以后新增的函数

  计算文本的距离和相似性函数:

JARO_DISTANCE, JARO_DIST
JARO_SIMILARITY, JARO_SIM
JARO_WINKER_DISTANCE, JW_DST
JARO_WINKER_SIMILARITY, JW_SIM

参考:

https://docs.cloudera.com/documentation/enterprise/latest/topics/impala_string_functions.html

http://impala.apache.org/docs/build/html/topics/impala_string_functions.html#string_functions__ascii

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 技术工厂 设计师:CSDN官方博客 返回首页