培训系列14--hive 对 字符串的操作

concat(string,string,string)
concat_ws(string,string,string)
select customer_id,concat_ws(" ",first_name,last_name),email,address_id from customer;
lower(string)
initcap(string)
if 表达式

select customer_id,if (length(first_name)>6 , substring(first_name,0,5),first_name),email,address_id from customer limit 10;

upper(string)

select if (length("abcdefghijk")>6, "a","b");
ltrim(string)
rtrim(string)
trim(string)
length(string)
reverse(string)
split(string,"\\|")

不能直接使用split里面的| 因为那样会把字符串里面的每一个字符都分开,有特定的含义。
select split("abc,def,aaa| bbb",",");

猜你喜欢

转载自www.cnblogs.com/davidzhu/p/10108267.html