Member since
10-03-2024
1
Post
0
Kudos Received
0
Solutions
10-03-2024
11:34 AM
For a hive2 cluster, I do not have to escape a double quote inside a regexp_replace where the single quotes to start and end the regex. But on hive3 in order for the code to work, the double quote needs to be escaped (Example to follow). Why the difference? -- Works in Hive 2 but not hive3
select
id
, case when
url rlike '(?i)^https://www.linkedin.com/("?in|pub|company|profile)' then url
else regexp_replace(url,'^https://www.linkedin.com/','https://www.linkedin.com/in/')
end as social_url
from db.table
limit 10
-- Works in hive3
select
id
, case when
url rlike '(?i)^https://www.linkedin.com/(\"?in|pub|company|profile)' then url
else regexp_replace(url,'^https://www.linkedin.com/','https://www.linkedin.com/in/')
end as social_url
from db.table
limit 10
... View more
Labels:
- Labels:
-
Apache Hive