蜂巢中的regexp_extract给出错误 [英] regexp_extract in hive giving error
本文介绍了蜂巢中的regexp_extract给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在表中有一些数据,例如:
I have some data in table e.g.:
id,params
123,utm_content=doit|utm_source=direct|
234,utm_content=polo|utm_source=AndroidNew|
使用regexp_extract所需的数据:
desired data using regexp_extract:
id,channel,content
123,direct,doit
234,AndroidNew,polo
使用的查询:
Select id, REGEXP_extract(lower(params),'(.*utm_source=)([^\|]*)(\|*)',2) as channel, REGEXP_extract(lower(params),'(.*utm_content=)([^\|]*)(\|*)',2) as content from table;
它显示错误'*悬挂元字符',并返回错误代码2
It is showing error '* dangling meta character' and returning error code 2
有人可以在这里帮忙吗?
Can someone help here please??
推荐答案
请注意,在 hive
中,您需要将反斜杠加倍.
Note that in hive
, you need to double the backslashes.
您的正则表达式应类似于
Your regex should look like
(.*utm_content=)([^|]*)(\\|*)
这篇关于蜂巢中的regexp_extract给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文