Hive本身並沒有replace方法,但是提供了以下兩個函數可以實現replace的類似功能
1、translate 函數
使用#字符替換逗號
select translate('hello world, this is a function, test in Hive', ',','#');
運行結果:
hello world# this is a function# test in Hive
2、regexp_replace 函數
使用#字符替換逗號
select regexp_replace('hello world, this is a function, test in Hive',"\\,","\\#");
運行結果:
hello world# this is a function# test in Hive