눈가락
[Pig Latin] 데이터 타입 확인 및 변경하는 방법
눈가락
2022. 3. 8. 11:52
아래와 같이 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;
참고