sql - 使用 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)
解决方案
怎么样replace()
?
select replace(replace(replace(col, '"', ''), '[', ''), ']', '')
推荐阅读
- php - 使用 PHP 正则表达式从字符串中提取年份
- javascript - 如何覆盖 Node.js 模块中的函数?
- batch-file - RegEx 适用于在线模拟器,但不适用于带有 findstr 的 BatchFile
- ios - AvPlayer 和 AirPlay 不能很好地工作
- android - 与 QUIC 一起使用的 Android WebView
- google-maps - React-native-Maps 附近的地点
- python - 如何启动运行具有多个参数的函数的单独进程?
- python - 在pytesseract python中保留多个空间
- apache-spark - 加入 SparkSQL 设计一个 JSON
- rx-java - 使用 RxJava 进行定期请求时如何避免重叠请求