The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Help with replace function in hive table

sebastian_gonzasebastian_gonza RapidMiner Certified Analyst, Member Posts: 52 Guru
edited December 2018 in Help

I have a Hive table in which I have some ID that are 10 characters long, but I have some cases in which is 9 characters, one of them is a point and what I need to do to correct it is to delete the point and add a zero in the beginning of the text, (The origin of the ID is nominal) I tried the following function but it says there is a problem with the array_contains, because is not an array, and I dont see any other function that does that, I saw there are some replace functions available but I dont see them displayed in rapidminer studio 8.2.

 

if(array_contains(cuenta,"."),concat("0",regexp_replace(cuenta,".",""),cuenta))

 

Please help me if you have any idea

Tagged:

Answers

  • mborbelymborbely Member Posts: 14 Contributor II

    Hi,

     

    How about using locate?

    select if(locate(".", cuenta) == 0, cuenta,concat("0",regexp_replace(cuenta,"\\.",""))) from table;

     

    Cheers,

    Máté

Sign In or Register to comment.