我有一个csv文件,其中有两个变量。我必须添加这两个变量: - 像工资和奖金(其中工资是逗号分隔的),但它没有发生在猪身上。我也尝试使用铸造。下面是数据集的屏幕截图: -
我使用了下面的猪脚本: -
register /home/ravimishra/piggybank-0.15.0.jar;
define CSVLoader org.apache.pig.piggybank.storage.CSVLoader();
emp_details_header = LOAD 'data/employee.csv' USING CSVLoader AS (id: int, name: chararray, address: chararray, occupation: chararray,salary: chararray,bonus: double);
ranked = rank emp_details_header;
NoHeader = Filter ranked by (rank_emp_details_header > 1);
B = FOREACH NoHeader GENERATE id,name,address,occupation, (double)salary + bonus as total ;