Error: Error while compiling statement: FAILED: SemanticException line 1:undefined:-1 Invalid function 'replace'

Keywords´╝Ü apache-spark hiveql impala hue

Question: 

I am using HIVE

I keep receiving the error message below whenever I run my code:

Error while compiling statement: FAILED: SemanticException line 1:undefined:-1 Invalid function 'replace'

Here is my code:

select 
ecat.count_category, eact.count_eventaction, elabel.count_eventlabel,
g.*,h.*  from db1.table1 g 
join (select count(distinct eventcategory) count_category, g.session_id from db1.table1 g group by g.session_id ) ecat on ecat.session_id = g.session_id
join (select count(distinct eventaction) count_eventaction,  g.session_id from db1.table1 g group by g.session_id) eact on eact.session_id = g.session_id
join (select count(distinct eventlabel) count_eventlabel, g.session_id from db1.table1 g group by g.session_id ) elabel on elabel.session_id = g.session_id
join (select replace(h.display_name, '\'', '') display_name, h.ncct_cat, h.ncct_cat_cd, h.ncct_trmnt_id, h.oop_proc_cd, replace(h.oop_diag_cd, '\'','') oop_diag_cd from db2.table2 h  
  where replace(h.display_name, '\'', '') =  'Ultrasound, Abdomen (Complete)' and 
   replace(h.client_code, '\'', '')='MASTER' ) h on 
   replace(h.display_name, '\'', '') = g.eventLabel and g.eventAction='ENCOUNTER';

Any ideas or suggestions as to why I keep receiving this error message? I am using HIVE.

Answers: