Pig is quite flexible when schema need to be manipulated.
Consider this data set
Suppose we needed to define schema after some processing we could cast the columns with their data types
That all for today folks.
Cheers!
Consider this data set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a,1,55,M,IND | |
b,2,55,M,US | |
c,3,56,F,GER | |
d,4,57,F,AUS |
Suppose we needed to define schema after some processing we could cast the columns with their data types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Load | |
A = load 'input' using PigStorage(','); | |
-- this will generate all columns after the first one | |
B = foreach A generate $1..; | |
--Suppose you need to cast the | |
C = FOREACH A generate (chararray)$0,(int)$1,(int)$2,(chararray)$3,(chararray)$4; | |
dump C; |
That all for today folks.
Cheers!
No comments:
Post a Comment