首页 > 解决方案 > 使用 hive hql 删除字符 [ ] 和 '

问题描述

如何使用包含此类字符串的 Hive HQL 清理列

["A","B","C"]
["ABC","RFG","ERD","BAC"]

为了只获取由?" "分隔的内部值,

期望的输出

A,B,C
ABC,RFG,ERD,BAC

我试过使用regexp_replace

regexp_replace(s_agr.sig_tecnologia,'["\]\[]','')

但我在下面收到此错误:

Error: Error while compiling statement: FAILED: SemanticException [Error 10014]: Line 53:1 Wrong arguments '''': No matching method for class org.apache.hadoop.hive.ql.udf.UDFRegExpReplace with (array<string>, string, string). Possible choices: _FUNC_(string, string, string) (state=42000,code=10014)

标签: sqlhivehql

解决方案


怎么样replace()

select replace(replace(replace(col, '"', ''), '[', ''), ']', '')

推荐阅读