Does Hive have a String split function?

前端 未结 3 956
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-13 05:48

I am looking for a in-built String split function in Hive? e.g. if String is:

A|B|C|D|E

Then I want to have a function like:



        
3条回答
  •  旧巷少年郎
    2020-12-13 06:35

    There does exist a split function based on regular expressions. It's not listed in the tutorial, but it is listed on the language manual on the wiki:

    split(string str, string pat)
       Split str around pat (pat is a regular expression) 
    

    In your case, the delimiter "|" has a special meaning as a regular expression, so it should be referred to as "\\|".

提交回复
热议问题