Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-2122

Parameter Substitution doesn't work in the Grunt shell

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.8.0, 0.8.1, 0.12.0
    • 0.14.0
    • grunt
    • None
    • Reviewed

    Description

      Simple param substitution and things like %declare (as copied out of the docs) don't work in the grunt shell.

      #Start Pig with: Start Pig with: bin/pig -x local -p time=FOO

      foo = LOAD '/user/grant/foo.txt' AS (a:chararray, b:chararray, c:chararray);
      Y = foreach foo generate *, '$time';
      dump Y;

      Output:

      2011-06-13 20:22:24,197 [main] INFO org.apache.pig.backend.hadoop.executionengine.util.MapRedUtil - Total input paths to process : 1
      (1 2 3,,,$time)
      (4 5 6,,,$time)

      Same script, stored in junk.pig, run as: bin/pig -x local -p time=FOO junk.pig

      2011-06-13 20:23:38,864 [main] INFO org.apache.pig.backend.hadoop.executionengine.util.MapRedUtil - Total input paths to process : 1
      (1 2 3,,,FOO)
      (4 5 6,,,FOO)

      Also, things like don't work (nor does %declare):

      grunt> %default DATE '20090101';
      2011-06-13 20:18:19,943 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during parsing. Encountered " <PATH> "%default "" at line 1, column 1.
      Was expecting one of:
      <EOF>
      "cat" ...
      "fs" ...
      "sh" ...
      "cd" ...
      "cp" ...
      "copyFromLocal" ...
      "copyToLocal" ...
      "dump" ...
      "describe" ...
      "aliases" ...
      "explain" ...
      "help" ...
      "kill" ...
      "ls" ...
      "mv" ...
      "mkdir" ...
      "pwd" ...
      "quit" ...
      "register" ...
      "rm" ...
      "rmf" ...
      "set" ...
      "illustrate" ...
      "run" ...
      "exec" ...
      "scriptDone" ...
      "" ...
      <EOL> ...
      ";" ...

      Details at logfile: /Users/grant.ingersoll/projects/apache/pig/release-0.8.1/pig_1308002917912.log

      Attachments

        1. PIG-2122-1.patch
          4 kB
          Daniel Dai

        Activity

          People

            sandeep.samudrala sandeep samudrala
            gsingers Grant Ingersoll
            Votes:
            10 Vote for this issue
            Watchers:
            14 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: