单个配置单元查询以删除数据中的某些文本

问题描述 投票:0回答:1

我有2种格式的列数据

1] "/abc/testapp/v1?FirstName=username&Lastname=test123"

2)"/abc/testapp/v1?FirstName=username"

我想以"/abc/testapp/v1?FirstName=username"的形式检索输出,并删除以“&Lastname”开头并以“”结尾的数据。其想法是删除带有其值的姓氏。但是,如果数据不包含“&Lastname”,那么按照第二种情况,它也应该可以正常工作示例中显示的Lastname的值为“ test123”,但通常来说是动态的]

我已从regexp_replace开始,但是我可以替换“&Lastname”,但不能替换其值。select regexp_replace("/abc/testapp/v1?FirstName=username&Lastname=test123&type=en_US","&Lastname","");有人可以在这里帮助我如何通过单个配置单元查询实现这两个目标吗?

我有2种格式的列数据,例如1)“ / abc / testapp / v1?FirstName = username&Lastname = test123” 2)“ / abc / testapp / v1?FirstName = username”我想将输出检索为“ / abc / testapp / v1?...

sql hadoop hive hiveql
1个回答
0
投票

我认为您需要像这样两次应用函数

© www.soinside.com 2019 - 2024. All rights reserved.