Member since
07-07-2017
1
Post
0
Kudos Received
0
Solutions
11-09-2017
12:13 PM
I am referring one basic pig script to count number of words as follows: A = load 'Desktop/wordcount.txt' as (col1:chararray);
B = foreach A generate flatten(TOKENIZE(col1)) as word;
grouped = group B by word;
cnt = foreach grouped generate B, COUNT(B);
dump cnt;
And using wordcount.txt file with contents as below: This is pig test
This is pig test
word in the above code is used as an alias for foreach A generate flatten(TOKENIZE(col1)) . Not able to exactly understand the use of below line grouped = group B by word and the role of alias over here.
... View more
Labels:
- Labels:
-
Apache Pig