1

我在 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 
4

1 回答 1

1
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  |
+----+----------------+
于 2017-06-13T07:34:09.803 回答