问题
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