Hive function to replace comma in column value

[亡魂溺海] 提交于 2019-12-22 09:48:08

问题


I have a hive table which has String column having value as 12,345. Is there any way hive function which can remove comma during insertion in this hive table ?


回答1:


You can use regexp_replace(string INITIAL_STRING, string PATTERN, string REPLACEMENT) which is a function in Hive.

So if you are moving the data from a table that contains the comma to a new table you will use :
insert into table NEW select regexp_replace(commaColumn,',','') from OLD;




回答2:


Hive does have split function. which can be used here. split and concat to achieve the desired result You may refer this question. Does Hive have a String split function?



来源:https://stackoverflow.com/questions/24501574/hive-function-to-replace-comma-in-column-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!