3

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 ?

Madhup Srivastava
  • 446
  • 1
  • 6
  • 18

2 Answers2

5

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;

dimamah
  • 2,883
  • 18
  • 31
0

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?

Community
  • 1
  • 1
Harikrishnan Ck
  • 920
  • 1
  • 11
  • 12