Hive字符函数

来源:互联网 发布:华为网络管理平台价格 编辑:程序博客网 时间:2024/06/06 00:44
一 常用字符函数
lower、upper、length、concat、substr、trim、lpad、rpad

二 实战
hive> select lower('Hello World'),upper('Hello World');
OK
hello world HELLO WORLD
hive> select length('Hello World'),length('你好');
OK
11 2
Time taken: 1.166 seconds, Fetched: 1 row(s)
hive> select concat('Hello',' World');
OK
Hello World
hive> select substr('hello World',3);
OK
llo World
Time taken: 0.122 seconds, Fetched: 1 row(s)
hive> select substr('hello World',3,4);
OK
llo
hive> select lpad('abcd',10,'&'),rpad('abcd',10,'*');
OK
&&&&&&abcd abcd******
Time taken: 0.144 seconds, Fetched: 1 row(s)
原创粉丝点击