Hive中的replace方法
Hive本身并没有replace方法,但是提供了两个方法可以实现replace功能
- translate
- regexp_replace
translate例子
使用空字符串替换#字符
> select translate('This #is test to verify# translate #Function in Hive', '#','');
+----------------------------------------------------+--+
| _c0 |
+----------------------------------------------------+--+
| This is test to verify translate Function in Hive |
+----------------------------------------------------+--+
1 row selected (0.28 seconds)
这个方法可用是在Hive 0.10.0
但是只针对单个字符,多字符会出错
select translate('hello','llo','a')