Hive中的replace類似方法


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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM