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

Pig should emit a warning if no store/dump/etc causes execution

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 0.12.0
    • Fix Version/s: None
    • Component/s: grunt, parser
    • Labels:

      Description

      If a script has no DUMP or STORE statement, there's nothing for pig to execute. This is totally obvious once you understand pig, but can be baffling to a novice.

      Pig should emit a warning: "Nothing to execute. DUMP and STORE cause Pig to execute a plan; ILLUSTRATE, EXPLAIN and DESCRIBE illuminate what it would execute. Did you mean to add one of those?" if nothing would cause output.

      There's a good argument for having it error with a non-zero exit code (rather than warn), but it is reasonable to run without content for linting purposes, so I believe an ignorable warning is best.

      The presence of an ILLUSTRATE, EXPLAIN or DESCRIBE should prevent the warning; it's pretty typical to comment out the store statement in favor of one of those while debugging.

      A pig script with only shell statements is a tougher call... Pig would be about the worst possible choice for a sysadmin scripting language, but I suppose there are oozie flows out there that might have Pig scripts with a shell statement. I believe that if there is a logical plan but no statement to cause output Pig should warn; a script of only shell statements should not cause a warning.

      I'm happy to implement this – my guess is that I'd have to

      1. find the point where pig in script mode decides what to execute;
      2. query the ?logical? plan about whether it includes one or more DUMP, STORE, ILLUSTRATE, EXPLAIN or DESCRIBE statements; and
      3. issue a log line at WARN level if none were found

      If someone can provide any brief high-level guidance about where to put the decision and how to query the plan, I'd be grateful.

        Attachments

          Activity

            People

            • Assignee:
              mrflip Flip Kromer
              Reporter:
              mrflip Flip Kromer
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: