아래와 같이 describe 명령어를 통해 데이터 타입을 확인 가능

 


batters = LOAD 'hdfs:/home/ubuntu/pigtest/Batting.csv' using PigStorage(',');
filtered_batters = FOREACH batters2 GENERATE $0 as id, $5 as bats;
describe filtered_batters;
filtered_batters: {id: bytearray, bats: bytearray}

 

 

아래와 같이 int 등으로 데이터 타입 변경 가능

 

filtered_batters = FOREACH batters2 GENERATE (int)$0 as id, (int)$5 as bats;

OR

filtered_batters = FOREACH batters2 GENERATE $0 as id:int, $5 as bats:int;
 

 

 

참고

https://stackoverflow.com/a/40835310

+ Recent posts