[Solved-1 Solution] How to debug a pig script ?
What is Pig Script ?
- Pig is a high level scripting language that is used with Apache Hadoop. Pig enables data workers to write complex data transformations without knowing Java. Pig’s simple SQL-like scripting language is called Pig Latin, and appeals to developers already familiar with scripting languages and SQL.
What is Debug ?
- debugging involves locating and correcting code errors in a computer program.
How to debug a Pig Script ?
- There are several method to debug a pig script. Simple method is step by step execution of a relation and then verify the result.
These commands are useful to debug a pig script.
- Use the DUMP operator to run (execute) Pig Latin statements and display the results to your screen.
- Use the ILLUSTRATE operator to review how data is transformed through a sequence of Pig Latin statements. ILLUSTRATE allows you to test your programs on small datasets and get faster turnaround times.
- Use the EXPLAIN operator to review the logical, physical, and map reduce execution plans that are used to compute the specified relationship.
- Use the DESCRIBE operator to view the schema of a relation. You can view outer relations as well as relations defined in a nested FOREACH statement.
If you want to debug whole script during execution then you need to write below code at top of your script
This will allow to run your script into debug mode.