2016-10-03 51 views
0

我寫了豬腳本:獲取錯誤錯誤1000:解析期間出錯。詞法錯誤

my_script.pig

bag_1 = LOAD '$INPUT' USING PigStorage('|') AS (LN_NR:chararray,ET_NR:chararray,ET_ST_DT:chararray,ED_DT:chararray,PI_ID:chararray); 
bag_2 = LIMIT bag_1 $SIZE; 
DUMP bag_2; 

並提出一個PARAM文件:

my_param.txt:

INPUT = hdfs://0.0.0.0:8020/user/training/example 
SIZE = 10 
現在

,我通過

pig my_param.txt my_script.pig 

此命令但出錯:

錯誤1000:解析期間出錯。詞法錯誤

+0

不知道更多的細節,如果這是需要(也許是甚至是錯誤的) ,但它可能需要引用字符串。 INPUT ='hdfs://0.0.0.0:8020/user/training/example' –

回答

0

我認爲你需要提供使用-m-param_file選項的參數文件的任何建議。請參閱下面的幫助文檔。

$ pig --help 
Apache Pig version 0.11.0-cdh4.7.1 (rexported) 
compiled Nov 18 2014, 09:08:23 

USAGE: Pig [options] [-] : Run interactively in grunt shell. 
     Pig [options] -e[xecute] cmd [cmd ...] : Run cmd(s). 
     Pig [options] [-f[ile]] file : Run cmds found in file. 
    options include: 
    -4, -log4jconf - Log4j configuration file, overrides log conf 
    -b, -brief - Brief logging (no timestamps) 
    -c, -check - Syntax check 
    -d, -debug - Debug level, INFO is default 
    -e, -execute - Commands to execute (within quotes) 
    -f, -file - Path to the script to execute 
    -g, -embedded - ScriptEngine classname or keyword for the ScriptEngine 
    -h, -help - Display this message. You can specify topic to get help for that topic. 
     properties is the only topic currently supported: -h properties. 
    -i, -version - Display version information 
    -l, -logfile - Path to client side log file; default is current working directory. 
    -m, -param_file - Path to the parameter file 
    -p, -param - Key value pair of the form param=val 
    -r, -dryrun - Produces script with substituted parameters. Script is not executed. 
    -t, -optimizer_off - Turn optimizations off. The following values are supported: 
      SplitFilter - Split filter conditions 
      PushUpFilter - Filter as early as possible 
      MergeFilter - Merge filter conditions 
      PushDownForeachFlatten - Join or explode as late as possible 
      LimitOptimizer - Limit as early as possible 
      ColumnMapKeyPrune - Remove unused data 
      AddForEach - Add ForEach to remove unneeded columns 
      MergeForEach - Merge adjacent ForEach 
      GroupByConstParallelSetter - Force parallel 1 for "group all" statement 
      All - Disable all optimizations 
     All optimizations listed here are enabled by default. Optimization values are case insensitive. 
    -v, -verbose - Print all error messages to screen 
    -w, -warning - Turn warning logging on; also turns warning aggregation off 
    -x, -exectype - Set execution mode: local|mapreduce, default is mapreduce. 
    -F, -stop_on_failure - Aborts execution on the first failed job; default is off 
    -M, -no_multiquery - Turn multiquery optimization off; default is on 
    -P, -propertyFile - Path to property file 
$ 
0

您沒有正確使用該命令。

要使用屬性文件,在命令中使用-param_file

pig -param_file <file> pig_script.pig 

您可以參考在Parameter Substitution