

{"id":14428,"date":"2018-04-21T13:40:01","date_gmt":"2018-04-21T13:40:01","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=14428"},"modified":"2018-04-21T13:40:01","modified_gmt":"2018-04-21T13:40:01","slug":"apache-pig-interview-questions","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/","title":{"rendered":"Top 30 Apache Pig Interview Questions and Answers (Latest)"},"content":{"rendered":"<p>Today, in this article, we will discuss \u201cTop 30 Apache Pig Interview Questions and answers\u201d. Here, we are providing Advanced Apache Pig Interview Questions that will help you in cracking your interview as well as to acquire a dream career as Apache\u00a0Pig Developer.<\/p>\n<p>If we talk about the current world, there are a lot of opportunities in\u00a0Pig Development in many reputed companies across the world.<\/p>\n<p>However, to go for\u00a0Pig jobs it is important to learn Apache\u00a0Pig in deep. So, if you\u2019re looking for Apache Pig Interview Questions &amp; Answers for Experienced or Freshers, you are at right place.<\/p>\n<p>So, let&#8217;s explore\u00a0Mostly Asked Apache Pig Interview Questions<\/p>\n<h2>Best 30 Apache Pig Interview Questions and Answers<\/h2>\n<p>There are various prominent Apache Pig Interview Questions. So, let\u2019s discuss\u00a0top 30 Apache Pig Interview Questions along with their answers:<\/p>\n<p><strong>Que 1.\u00a0Define Apache Pig<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. To analyze large data sets representing them as data flows, we use Apache Pig. Basically, \u00a0to provide an abstraction over MapReduce, reducing the complexities of writing a MapReduce task using <strong>Java programming<\/strong>, Apache Pig is designed. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Moreover, using Apache Pig, we can perform data manipulation operations very easily in <strong>Hadoop<\/strong>.<\/span><\/p>\n<p><strong>Que 2. Why Do We Need Apache Pig?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. At times, while performing any MapReduce tasks, programmers who are not so good at Java normally used to struggle to work with Hadoop. Hence, Pig is a boon for all such programmers. The reason is:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Using Pig Latin, programmers can perform <strong>MapReduce<\/strong> tasks easily, without having to type complex codes in Java.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Since Pig uses multi-query approach, it also helps in reducing the length of codes. <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It is easy to learn Pig when you are familiar with SQL. It is because Pig Latin is SQL-like language.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In order to support data operations, it offers many built-in operators like joins, filters, ordering, and many more. And, it offers nested data types that are missing from MapReduce, for example, tuples, bags, and maps.<\/span><\/li>\n<\/ul>\n<p><strong>Que 3. What is the difference between Pig and SQL?<\/strong><\/p>\n<p>Ans. Here, are the list of major differences between Apache Pig and SQL.<\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">It is a procedural language.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>SQL<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">While it is a declarative language.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Here, the schema is optional. Although, without designing a schema, we can store data. However, it stores values as $01, $02 etc.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>SQL<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">In SQL, Schema is mandatory.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">In Pig, data model is nested relational.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>SQL<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">In SQL, data model used is flat relational.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Here, we have limited opportunity for query optimization.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>SQL<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">While here we have more opportunity for query optimization.<\/span><\/p>\n<p><strong>Que 4. Explain the architecture of Hadoop Pig.<\/strong><\/p>\n<p><strong>Ans. <\/strong>Below is the image, which shows the architecture of Apache Pig.<\/p>\n<div id=\"attachment_15669\" style=\"width: 1090px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Components-of-Apache-Pig.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-15669\" class=\"wp-image-15669 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Components-of-Apache-Pig.png\" alt=\"Best 30 Apache Pig Interview Questions and Answers\" width=\"1080\" height=\"1080\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Components-of-Apache-Pig.png 1080w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Components-of-Apache-Pig-150x150.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Components-of-Apache-Pig-300x300.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Components-of-Apache-Pig-768x768.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Components-of-Apache-Pig-1024x1024.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Components-of-Apache-Pig-100x100.png 100w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><p id=\"caption-attachment-15669\" class=\"wp-caption-text\">Best 30 Apache Pig Interview Questions and Answers<\/p><\/div>\n<p><span style=\"font-weight: 400\">Now, we can see, several components in the Hadoop Pig framework. The major components are:<\/span><\/p>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">1. Parser<\/span><\/strong><\/p>\n<p><span style=\"font-weight: 400\">At first, Parser handles all the Pig Scripts. Basically, Parser checks the syntax of the script, does type checking, and other miscellaneous checks. Afterward, Parser\u2019s output will be a DAG (directed acyclic graph). That represents the Pig Latin statements as well as logical operators.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Basically, the logical operators of the script are represented as the nodes and the data flows are represented as edges, in the DAG (the logical plan).<\/span><\/p>\n<p><strong>2. Optimizer<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Further, DAG is passed to the logical optimizer. That carries out the logical optimizations, like projection and push down.<\/span><\/p>\n<p><strong>3. Compiler<\/strong><\/p>\n<p>A series of MapReduce jobs have compiled from an optimized logical plan.<\/p>\n<p><strong>4. Execution engine<\/strong><\/p>\n<p><span style=\"font-weight: 400\">At last, these jobs are submitted to Hadoop in a sorted order.<\/span><span style=\"font-weight: 400\">\u00a0Hence, these MapReduce jobs are executed finally on Hadoop, that produces the desired results.<\/span><\/p>\n<p><strong>Que 5. What is the difference between Apache Pig and Hive?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. Basically, to create MapReduce jobs, we use both Pig and Hive. Also, we can say, at times, Hive operates on<strong> HDFS<\/strong> as same as Pig does. So, here we are listing few significant points those set Apache Pig apart from<strong> Hive<\/strong>.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Hadoop Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Pig Latin is a language, Apache Pig uses. Originally, it was created at Yahoo.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Hive<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">HiveQL is a language, Hive uses. It was originally created at Facebook.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">It is a data flow language.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Hive<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Whereas, it is a query processing language.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Moreover, it is a procedural language which fits in pipeline paradigm.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Hive<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">It is a declarative language.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Apache Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Also, can handle structured, unstructured, and semi-structured data.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Hive<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Whereas, it is mostly for structured data.<\/span><\/p>\n<p><strong>Que 6. What is the difference between Pig and MapReduce?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. Some major differences between Hadoop Pig and MapReduce, are:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Apache Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">It is a data flow language.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>MapReduce<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">However, it is a data processing paradigm.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Hadoop Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Pig is a high-level language.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>MapReduce<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Well, it is a low level and rigid.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Pig<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">In Apache Pig, performing a join operation is pretty simple.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>MapReduce<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">But, in MapReduce, it is quite difficult to perform a join operation between datasets.<\/span><\/p>\n<p><strong>Que 7. Explain Features of Pig.<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. There are several features of Pig, such as:<\/span><\/p>\n<div id=\"attachment_15661\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Features-of-Pig-01-1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-15661\" class=\"wp-image-15661 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Features-of-Pig-01-1.jpg\" alt=\"Features of Pig\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Features-of-Pig-01-1.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Features-of-Pig-01-1-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Features-of-Pig-01-1-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Features-of-Pig-01-1-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Features-of-Pig-01-1-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-15661\" class=\"wp-caption-text\">Features of Pig<\/p><\/div>\n<ul>\n<li><strong> Rich set of operators<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">In order to perform several operations, Pig offers many operators, for example, join, sort, filer and many more.<\/span><\/p>\n<ul>\n<li><strong> Ease of programming<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Since you are good at SQL, it is easy to write a Pig script. Because of Pig Latin as same as SQL.<\/span><\/p>\n<ul>\n<li><strong>Optimization opportunities<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">In Apache Pig, all the tasks optimize their execution automatically. As a result, the programmers need to focus only on the semantics of the language.<\/span><\/p>\n<ul>\n<li><strong> Extensibility<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Through Pig, it is easy to read, process, and write data. It is possible by using the existing operators. Also, users can develop their own functions.<\/span><\/p>\n<ul>\n<li><strong> UDF\u2019s<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">By using Pig, we can create User-defined Functions in other programming languages. Like Java. Also, can invoke or embed them in Pig Scripts.<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><\/p>\n<p><strong>Que 8. What is Pig Storage?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. In Pig, there is a default load function, that is Pig Storage. Also, we can use pig storage, whenever we want to load data from a file system into the pig. <\/span><\/p>\n<p><span style=\"font-weight: 400\">We can also specify the delimiter of the data while loading data using pig storage (how the fields in the record are separated). Also, we can specify the schema of the data along with the type of the data.<\/span><\/p>\n<p><strong>Que 9. While writing evaluate UDF, which method has to be overridden?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. We have to override the method exec() while writing UDF in the Pig. Whereas the base class can be different while writing filter UDF, we will have <\/span><span style=\"font-weight: 400\">to extend FilterFunc and for evaluate UDF, we will have to extend the EvalFunc. EvaluFunc is parameterized and must provide the return type also.<\/span><\/p>\n<p><strong>Que 10. What are the different UDF\u2019s in Pig?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. On the basis of the number of rows, UDF can be processed. They are of two types:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">UDF that takes one record at a time, for example, Filter and Eval.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">UDFs that take multiple records at a time, for example, Avg and Sum.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Also, pig gives you the facility to write your own UDF\u2019s for load\/store the data.<\/span><\/p>\n<p><strong>Apache Pig Interview Questions and Answers For Freshers. Q- 1,2,4,7<\/strong><\/p>\n<p><strong>Apache Pig Interview Questions and Answers For Experience. Q- 3,5,6,8,9,10<\/strong><\/p>\n<p><strong>Que 11. What are the Optimizations a developer can use during joins?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. We use replicated join, to perform join between a small dataset with a large dataset. Moreover, in the replicated join, the small dataset will be copied to all the machines where the mapper is running and the large dataset is divided across all the nodes. Also, it gives us the advantage of Map-side joins.<\/span><\/p>\n<p><span style=\"font-weight: 400\">If your dataset is skewed i.e. if a particular data is repeated multiple times even if you use reduce side join, the particular reducer will be overloaded and it will take a lot of time. Pig itself, calculates skewed join and the skewed key.<\/span><\/p>\n<p><span style=\"font-weight: 400\">And, if you have datasets where the records are sorted in the same field, you can go for sorted join, this also happens in map phase and is very efficient and fast.<\/span><\/p>\n<p><strong>Que 12. What is a skewed join?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. While we want to perform a join with a skewed dataset, that means a particular value will be repeated many times, is a skewed join.<\/span><\/p>\n<p><strong>Que 13. What is Flatten?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. An operator in pig that removes the level of nesting, is Flatten. Sometimes, we have data in a bag or a tuple and we want to remove the level of nesting so that the data structured should become even, we use Flatten.<br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 400\">In addition, each Flatten produces a cross product of every record in the bag with all of the other expressions in the general statement.<\/span><\/p>\n<p><strong>Que 14. What are the complex data types in pig?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. The following are the complex data types in Pig:<\/span><\/p>\n<div id=\"attachment_15659\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Data-Types-in-Pig-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-15659\" class=\"wp-image-15659 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Data-Types-in-Pig-01.jpg\" alt=\"Data types in Pig\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Data-Types-in-Pig-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Data-Types-in-Pig-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Data-Types-in-Pig-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Data-Types-in-Pig-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/Data-Types-in-Pig-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-15659\" class=\"wp-caption-text\">Data types in Pig<\/p><\/div>\n<ul>\n<li style=\"font-weight: 400\"><strong>Tuple<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">An ordered set of fields is what we call a tuple.<\/span><br \/>\n<span style=\"font-weight: 400\"><strong>For Example:<\/strong> (Ankit, 32)<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Bag<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">A collection of tuples is what we call a bag.<\/span><br \/>\n<span style=\"font-weight: 400\"><strong>For Example:<\/strong> {(Ankit,32),(Neha,30)}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Map<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">A set of key-value pairs is what we call a Map.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>For Example:<\/strong> [ \u2018name\u2019#\u2019Ankit\u2019, \u2018age\u2019#32]<\/span><\/p>\n<p><strong>Que 15. Why we use BloomMapFile?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. In order to extend MapFile, we use the BloomMapFile. That implies its functionality is similar to MapFile.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Also, to provide quick membership test for the keys, BloomMapFile uses dynamic Bloom filters. We use it in<strong> HBase <\/strong>table format.<\/span><\/p>\n<p><strong>Que 16. How will you explain COGROUP in Pig?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. In Apache Pig, COGROUP works on tuples. On several statements, we can apply operators, which contains a few relations at least 127 relations at every time. <\/span><\/p>\n<p><span style=\"font-weight: 400\">When you make use of the operator on tables, then Pig immediately books two tables and join them through some of the columns that are grouped.<\/span><\/p>\n<p><strong>Que 17. What is the difference between logical and physical plans?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. Pig undergoes some steps when a Pig Latin Script is converted into MapReduce jobs. After performing the basic parsing and semantic checking, it produces a logical plan. The logical plan describes the logical operators that have to be executed by Pig during execution. <\/span><\/p>\n<p><span style=\"font-weight: 400\">After this, Pig produces a physical plan. The physical plan describes the physical operators that are needed to execute the script.<\/span><\/p>\n<p><strong>Que 18. Does \u2018ILLUSTRATE\u2019 run MR job?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. It will pull the internal data, illustrate will not pull any MR. Moreover, illustrate will not do any job, on the console. It just shows the output of each stage and not the final output.<\/span><\/p>\n<p><strong>Que 19. Is the keyword \u2018DEFINE\u2019 as a function name?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. The keyword \u2018DEFINE\u2019 is like a function name. As soon as we have registered, we have to define it. Whatever logic you have written in Java program, we have an exported jar and also a jar registered by us. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Now the compiler will check the function in the exported jar. When the function is not present in the library, it looks into our jar.<\/span><\/p>\n<p><strong>Que 20. Is the keyword \u2018FUNCTIONAL\u2019 a User Defined Function (UDF)?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. The keyword \u2018FUNCTIONAL\u2019 is not a User Defined Function (UDF). we have to override some functions while using UDF. Certainly, we have to do our job with the help of these functions only. <\/span><\/p>\n<p><span style=\"font-weight: 400\">However, the keyword \u2018FUNCTIONAL\u2019 is a built-in function i.e a predefined function, therefore it does not work as a UDF.<\/span><\/p>\n<p><strong>Apache Pig Interview Questions and Answers For Freshers. Q- 12,13,14,15,16,17<\/strong><\/p>\n<p><strong>Apache Pig Interview Questions and Answers For Experience. Q- 11,18,19,20<\/strong><\/p>\n<p><strong>Que 21. Why do we need MapReduce during Pig programming?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. Let\u2019s understand it in this way- Pig is a high-level platform that makes many Hadoop data analysis issues easier to execute. And, we use Pig Latin for this platform. Now, a program written in Pig Latin is like a query written in SQL, where we need an execution engine to execute the query. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Hence, when we write a program in Pig Latin, it was converted into MapReduce jobs by pig complier. As a result, MapReduce acts as an execution engine.<\/span><\/p>\n<p><strong>Q 22 What are the scalar data types in Pig?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. In Apache Pig, Scalar data types are:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">int\u00a0 \u00a0 \u00a0 \u00a0 -4bytes,<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">float\u00a0 \u00a0 \u00a0-4bytes,<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">double\u00a0 -8bytes,<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">long\u00a0 \u00a0 \u00a0-8bytes,<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">char array,<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">byte array<\/span><\/li>\n<\/ul>\n<p><strong>Que 23 What are the different execution mode available in Pig?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. In Pig, there are 3 modes of execution available:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Interactive Mode (Also known as Grunt Mode)<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Batch Mode<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Embedded Mode<\/span><\/li>\n<\/ul>\n<p><strong>Que 24. Whether Pig Latin language is case-sensitive or not?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. We can say, Pig Latin is sometimes not a case-sensitive, for example, Load is equivalent to load.<\/span><\/p>\n<p><span style=\"font-weight: 400\">A=load \u2018b\u2019 is not equivalent to a=load \u2018b\u2019<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>Note:<\/strong> UDF is also case-sensitive, here count is not equivalent to COUNT.<\/span><\/p>\n<p><strong>Que 25. What is the purpose of \u2018dump\u2019 keyword in Pig?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. The keyword \u201cdump\u201d displays the output on the screen.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>For Example-<\/strong> dump \u2018processed\u2019<\/span><\/p>\n<p><strong>Que 26. Does Pig give any warning when there is a type mismatch or missing field?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. The pig will not show any warning if there is no matching field or a mismatch. However, if any mismatch occurs, it assumes a null value in Pig.<\/span><\/p>\n<p><strong>Que 27. What is Grunt shell?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. Grunt shell is also\u00a0what we call as Pig interactive shell. Basically, it offers a shell for users to interact with HDFS.<\/span><\/p>\n<p><strong>Que 28. What co-group does in Pig?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. Basically, it joins the data set by grouping one particular data set only. Moreover, it groups the elements by their common field and then returns a set of records containing two separate bags. <\/span><\/p>\n<p><span style=\"font-weight: 400\">One bag consists of the record of the first data set with the common data set, while and other bag consists of the records of the second data set with the common data set.<\/span><\/p>\n<p><strong>Que 29. What are relational operations in Pig latin?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. Relational operations in Pig Latin are:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">For each<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Order by<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Filters<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Group<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Distinct<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Join<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Limit<\/span><\/li>\n<\/ul>\n<p><strong>Que 30. How is Pig Useful For?<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Ans. There are 3 possible categories for which we can use Pig. They are:<\/span><\/p>\n<p><span style=\"font-weight: 400\">1) ETL data pipeline <\/span><br \/>\n<span style=\"font-weight: 400\">2) Research on raw data <\/span><br \/>\n<span style=\"font-weight: 400\">3) Iterative processing<\/span><\/p>\n<p><strong>Apache Pig Interview Questions and Answers For Freshers. Q- 21,22,25,26,27,28,29,30<\/strong><\/p>\n<p><strong>Apache Pig Interview Questions and Answers For Experience. Q- 23,24<\/strong><\/p>\n<p>So, this was all\u00a0about Apache Pig Interview Questions and Answers Tutorial. Hope you like our explanation<b><\/b>.<\/p>\n<h2>Conclusion: Apache Pig Interview Questions<\/h2>\n<p>Hence, we have covered top 30 Apache Pig Interview Questions. However, if any doubt occurs, feel free to ask through the comment tab.<\/p>\n<p>Also, if you have attended Pig interviews previously, we appreciate you to add your Apache Pig Interview Questions in the comments tab. That will help a lot of your fellow job seekers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, in this article, we will discuss \u201cTop 30 Apache Pig Interview Questions and answers\u201d. Here, we are providing Advanced Apache Pig Interview Questions that will help you in cracking your interview as well&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":44717,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[876,6961,6973,9507,9519],"class_list":["post-14428","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pig","tag-apache-pig-interview-questions","tag-interview-questions-for-pig","tag-interview-questions-in-pig","tag-pig-interview-questions","tag-pig-real-time-interview-questions"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Top 30 Apache Pig Interview Questions and Answers (Latest) - DataFlair<\/title>\n<meta name=\"description\" content=\"Apache Pig Interview Questions 2018-real-time Interview questions to crack pig interview, pig interview questions for pig developers &amp; pig Programmer\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Top 30 Apache Pig Interview Questions and Answers (Latest) - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Apache Pig Interview Questions 2018-real-time Interview questions to crack pig interview, pig interview questions for pig developers &amp; pig Programmer\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-21T13:40:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Pig-Interview-Questions.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Top 30 Apache Pig Interview Questions and Answers (Latest) - DataFlair","description":"Apache Pig Interview Questions 2018-real-time Interview questions to crack pig interview, pig interview questions for pig developers & pig Programmer","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/","og_locale":"en_US","og_type":"article","og_title":"Top 30 Apache Pig Interview Questions and Answers (Latest) - DataFlair","og_description":"Apache Pig Interview Questions 2018-real-time Interview questions to crack pig interview, pig interview questions for pig developers & pig Programmer","og_url":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-04-21T13:40:01+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Pig-Interview-Questions.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Top 30 Apache Pig Interview Questions and Answers (Latest)","datePublished":"2018-04-21T13:40:01+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/"},"wordCount":2417,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Pig-Interview-Questions.jpg","keywords":["Apache Pig Interview Questions","Interview questions for pig","interview questions in pig","pig interview questions","Pig real time interview questions"],"articleSection":["Pig Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/","url":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/","name":"Top 30 Apache Pig Interview Questions and Answers (Latest) - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Pig-Interview-Questions.jpg","datePublished":"2018-04-21T13:40:01+00:00","description":"Apache Pig Interview Questions 2018-real-time Interview questions to crack pig interview, pig interview questions for pig developers & pig Programmer","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Pig-Interview-Questions.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Pig-Interview-Questions.jpg","width":1200,"height":628,"caption":"Apache Pig Interview Questions and Answers"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/apache-pig-interview-questions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Pig Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/pig\/"},{"@type":"ListItem","position":3,"name":"Top 30 Apache Pig Interview Questions and Answers (Latest)"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/14428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=14428"}],"version-history":[{"count":0,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/14428\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/44717"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=14428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=14428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=14428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}