strsplit issue - Pig

前端 未结 2 1834
甜味超标
甜味超标 2021-02-20 04:28

I have following tuple H1 and I want to strsplit its $0 into tuple.However I always get an error message:

DUMP H1:
(item32;item31;,1)

m = FOREACH H1 GENERATE S         


        
2条回答
  •  我寻月下人不归
    2021-02-20 05:32

    STRSPLIT on a semi-colon is tricky. I got it to work by putting it inside of a block.

    raw = LOAD 'cname.txt' as (name,cname_string:chararray);
    
    xx = FOREACH raw {
      cname_split = STRSPLIT(cname_string,';');
      GENERATE cname_split;
    }
    

    Funny enough, this is how I originally implemented my STRSPLIT() command. Only after trying to get it to split on a semicolon did I run into the same issue.

提交回复
热议问题