presto语法:
substr(string, start, length) → varchar 如: select substr('1599319787151',1,10)
substr(string, start) → varchar 如: select substr('1599319787151',1)
而hive中:substr和substring都可以使用
presto语法:
regexp_replace(string, pattern, replacement) → varchar
如:select regexp_replace('{\\"over\\":\\"0\\",\\"seckill\\":\\"0\\"}','\\','')
presto语法:
position(substring IN string) → bigint 如:select position('aa' in '15993aa1978715aa1')
而hive中:select INSTR('15993aa1978715aa1','aa')
presto语法:concat(string1, ..., stringN) → varchar 如:select concat('kk','rrr')
而hive中除了concat,还有concat_ws按分隔符分割,如:select concat_ws("-","iii","rrr","kkk")
presto语法:
split(string, delimiter) -> array(varchar) 如:SELECT split('a,b,c,d',',') 得到:[a, b, c, d]
split_part(string, delimiter, index) → varchar 如:SELECT split_part('a,b,c,d',',',2) 得到:b
String Functions and Operators — Presto 0.277 Documentationhttps://prestodb.io/docs/current/functions/string.html
Regular Expression Functions — Presto 0.277 Documentationhttps://prestodb.io/docs/current/functions/regexp.html?highlight=regexp_replace#id3