gpt4 book ai didi

hadoop - pig 错误: unexpected character '\'

转载 作者:可可西里 更新时间:2023-11-01 16:03:51 27 4
gpt4 key购买 nike

我是 hadoop 和 pig 的新手。我正在尝试在 VMWARE 上的 CentOS6 环境中运行示例 pig 脚本:

records = LOAD '2013_subset.csv' USING PigStorage(',') AS              
(Year,Month,DayofMonth,DayOfWeek,DepTime,CRSDepTime,ArrTime,\
CRSArrTime,UniqueCarrier,FlightNum,TailNum,ActualElapsedTime,\
CRSElapsedTime,AirTime,ArrDelay,DepDelay,Origin,Dest,\
Distance:int,TaxiIn,TaxiOut,Cancelled,CancellationCode,\
Diverted,CarrierDelay,WeatherDelay,NASDelay,SecurityDelay,\ LateAircraftDelay);milage_recs =
GROUP records ALL;tot_miles = FOREACH milage_recs GENERATE SUM(records.Distance);STORE tot_miles INTO /user/root/totalmiles;

此代码保存到名为 totalmiles.pig 的文件中。运行后,它完成并出现以下错误:

ERROR org.apache.pig.tools.grunt.GRUNT - -ERROR: Unexpected character '\'

当从代码中删除字符 '\' 时,我得到一个不同的错误:

ERROR org.apache.pig.tools.grunt.GRUNT - -ERROR: mismatched input '/' expecting QUOTEDSTRING

我一直没能找到这个特定错误的解决方案。我在 Centos7 下的不同虚拟机 (virtulabox) 上运行它并收到一个不同的错误 参数替换 :i 。我希望有人能够阐明这一点。

谢谢!wasmithpfs

最佳答案

删除反斜杠,即“\”,在存储语句中,路径必须用引号引起来。

records = LOAD '2013_subset.csv' USING PigStorage(',') AS (Year,Month,DayofMonth,DayOfWeek,DepTime,CRSDepTime,ArrTime,RSArrTime,UniqueCarrier,FlightNum,TailNum,ActualElapsedTime,CRSElapsedTime,AirTime,ArrDelay,DepDelay,Origin,Dest,Distance:int,TaxiIn,TaxiOut,Cancelled,CancellationCode,Diverted,CarrierDelay,WeatherDelay,NASDelay,SecurityDelay,LateAircraftDelay);
milage_recs = GROUP records ALL;
tot_miles = FOREACH milage_recs GENERATE SUM(records.Distance);
STORE tot_miles INTO '/user/root/totalmiles';

关于hadoop - pig 错误: unexpected character '\' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37487677/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com