从一个字符串中查找所有出现的地方 - Presto
Find all occurrences from a string - Presto
我将以下内容作为 HIVE (HDFS) 中的行并使用 Presto 作为查询引擎。
1,@markbutcher72 @charlottegloyn Not what Belinda Carlisle thought. And yes, she was singing about Edgbaston.
2,@tomkingham @markbutcher72 @charlottegloyn It's true the garden of Eden is currently very green...
3,@MrRhysBenjamin @gasuperspark1 @markbutcher72 Actually it's Springfield Park, the (occasional) home of the might
需求是通过Presto Query获取以下内容。请问如何才能得到这个
1,markbutcher72
1,charlottegloyn
2,tomkingham
2,markbutcher72
2,charlottegloyn
3,MrRhysBenjamin
3,gasuperspark1
3,markbutcher72
select t.id
,u.token
from mytable as t
cross join unnest (regexp_extract_all(text,'(?<=@)\S+')) as u(token)
;
+----+----------------+
| id | token |
+----+----------------+
| 1 | markbutcher72 |
| 1 | charlottegloyn |
| 2 | tomkingham |
| 2 | markbutcher72 |
| 2 | charlottegloyn |
| 3 | MrRhysBenjamin |
| 3 | gasuperspark1 |
| 3 | markbutcher72 |
+----+----------------+
我将以下内容作为 HIVE (HDFS) 中的行并使用 Presto 作为查询引擎。
1,@markbutcher72 @charlottegloyn Not what Belinda Carlisle thought. And yes, she was singing about Edgbaston.
2,@tomkingham @markbutcher72 @charlottegloyn It's true the garden of Eden is currently very green...
3,@MrRhysBenjamin @gasuperspark1 @markbutcher72 Actually it's Springfield Park, the (occasional) home of the might
需求是通过Presto Query获取以下内容。请问如何才能得到这个
1,markbutcher72
1,charlottegloyn
2,tomkingham
2,markbutcher72
2,charlottegloyn
3,MrRhysBenjamin
3,gasuperspark1
3,markbutcher72
select t.id
,u.token
from mytable as t
cross join unnest (regexp_extract_all(text,'(?<=@)\S+')) as u(token)
;
+----+----------------+
| id | token |
+----+----------------+
| 1 | markbutcher72 |
| 1 | charlottegloyn |
| 2 | tomkingham |
| 2 | markbutcher72 |
| 2 | charlottegloyn |
| 3 | MrRhysBenjamin |
| 3 | gasuperspark1 |
| 3 | markbutcher72 |
+----+----------------+