Pls help advise.
Scenario: Store data from HDFS to Hive using Pig.
I have file that scooped from mySQL, which has 4 fields Ord_Id, Cust_Id, Cust_name, Ord_date. I like to Store only 2 fields Ord_Id and Cust_Id to Hive. How could I do it? pls advise.
below code can't execute:
orders = LOAD '<HDFS_file_path>' USAGE PigStorage(',') AS (Ord_Id:Int, Cust_Id:Int, Cust_name:chararray, Ord_date:chararray);
STORE orders INTO 'pig_demo.orders' USAGE org.apache.hive.hcatalog.pig.HCatStorer();
Have you tried to add the following before you STORE orders:
orders2 = FOREACH orders GENERATE Ord_Id, Cust_Id;
STOREorders2 INTO 'pig_demo.orders' USAGE org.apache.hive.hcatalog.pig.HCatStorer();
See whether it helps. More information can be found here: