ihadanny
ihadanny

Reputation: 4483

pig: how can I extract a tuple with all characters in a chararray?

I have a tuple with my_string = '12345', I want to turn it into this tuple: ('1','2','3','4','5').

Tried: REGEX_EXTRACT_ALL(my_string, '(.)') and got only (1).

Upvotes: 0

Views: 427

Answers (1)

Anirudha
Anirudha

Reputation: 32787

Use Replace to turn it into (1,2,3,4,5,6).

REPLACE(my_string,'(?<!^)(.)',',$1');

Upvotes: 1

Related Questions