Pig 0.17.0执行Load&Dump命令遇Error 1066求助
Hey there! Let's dig into why you're hitting Error 1066 when running your Pig commands in Grunt. Based on your setup and the logs you shared, here are the most likely causes and fixes:
1. Delimiter Mismatch (Biggest Suspect!)
You're loading a .csv file but using PigStorage('\t')—which tells Pig to expect tab-separated values. CSV files almost always use commas as the default separator, so Pig is trying to parse your data with the wrong delimiter, leading to parsing failures and Error 1066.
Quick Fix:
Switch to comma-separated delimiter in your load statement:
summerolympic = load '/olympics/input/summer.csv' using PigStorage(','); dump summerolympic;
If your CSV has quoted fields or more complex formatting (like commas inside quotes), use Piggybank's CSVLoader instead (you'll need to register the piggybank jar first):
REGISTER /Users/vaisakh/pig-0.17.0/lib/piggybank.jar; summerolympic = load '/olympics/input/summer.csv' using org.apache.pig.piggybank.storage.CSVLoader(); dump summerolympic;
2. Check if Your HDFS Path Exists & Has Permissions
Error 1066 often pops up when Pig can't access the input file. Let's verify:
- First, confirm the file exists in HDFS using the Hadoop CLI:
hdfs dfs -ls /olympics/input/
- If the file is missing, upload it from your local system:
hdfs dfs -put /path/to/your/local/summer.csv /olympics/input/
- Make sure your user has read access to the file:
hdfs dfs -chmod +r /olympics/input/summer.csv
3. Get the Full Error Log
Your provided log cuts off mid-line (INFO org.apache.pi), which means we're missing the actual error message that would tell us the exact root cause (like a parsing failure, file not found, etc.).
How to get the full log:
- Check the local Pig logs (usually in directories named
pig_*in your home folder, or the path configured inpig.properties). - Alternatively, look up the job in the Hadoop ResourceManager UI (default at
http://your-rm-host:8088) to view the full job logs. Look for lines markedERROR—they'll have the specific issue.
4. Resolve the "No job jar file set" Warning
While this warning isn't the direct cause of Error 1066, it's good to fix it to avoid potential issues later. Explicitly specify the Pig core jar when launching Pig:
pig -jar /Users/vaisakh/pig-0.17.0/pig-0.17.0-core-h2.jar
Start with the delimiter fix first—it's the most probable issue here. If that doesn't work, check the file path and permissions, then grab the full log for more details.
内容的提问来源于stack exchange,提问作者VaisakhSrinivas

