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

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

我正在使用 HIVE

每当我 运行 我的代码时,我都会收到以下错误消息:

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

这是我的代码:

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';

关于为什么我一直收到此错误消息,有什么想法或建议吗?我正在使用 HIVE。

Hive replace功能从1.3.0版本开始引入

select replace(string("kkl'll"),'\'','')="kk";
false

检查您在环境中使用的配置单元版本

要解决此问题,请使用 regexp_replace 函数。

select regexp_replace(string("kkl'll"),'\'','')="kk";
false