Это то, что @lazilyInitialised сказал, я сделал запрос с вашим примером данных:
with your_data as (--This is your data example, use your table instead of this CTE
select stack( 1,
1, --ID
" NeverTrump is never more. They were crushed last night in Cleveland at Rules Committee by a vote of 87-12. MAKE AMERICA GREAT AGAIN!
CrookedHillary is outspending me by a combined 31 to 1 in Florida, Ohio, & Pennsylvania. I haven't started yet!
CrookedHillary is not qualified!
MakeAmericaSafeAgain!#GOPConvention #RNCinCLE
MakeAmericaGreatAgain #ImWithYou
"
) as (id, str)
)
select id, word as hashtag
from
(
select id, word
from your_data d
lateral view outer explode(split(regexp_replace(d.str, '#',' #' ),'\\s')) l as word --replace hash w space+hash, split and explode words
)s
where word rlike '^#'
;
Результат:
OK
id hashtag
1 #GOPConvention
1 #RNCinCLE
1 #ImWithYou
Time taken: 0.405 seconds, Fetched: 3 row(s)