

{"id":770,"date":"2016-08-03T09:58:24","date_gmt":"2016-08-03T09:58:24","guid":{"rendered":"http:\/\/data-flair.training\/blogs\/?p=770"},"modified":"2016-08-03T09:58:24","modified_gmt":"2016-08-03T09:58:24","slug":"apache-pig-tutorial-introduction-guide","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/","title":{"rendered":"Apache Pig Tutorial &#8211; An Introduction guide"},"content":{"rendered":"<p>This Apache Pig tutorial provides the basic introduction to Apache Pig &#8211; high-level tool\u00a0over MapReduce.<\/p>\n<p>This tutorial helps professionals who are working on Hadoop and would like to perform MapReduce operations using a high-level scripting language instead of developing\u00a0complex codes in Java.<\/p>\n<h2>Apache Pig Introduction<\/h2>\n<h3>a. History of Apache Pig<\/h3>\n<p>As a research project at Yahoo in the year 2006, Apache Pig was developed in order to create and execute MapReduce jobs on large\u00a0data-sets. In 2007 Apache Pig was open sourced, later in 2008, Apache Pig\u2019s first release came out.<\/p>\n<h3>b. Introduction to Apache Pig<\/h3>\n<p>Pig was created to simplify the burden of writing complex Java codes to perform MapReduce jobs. Earlier Hadoop developers have to write complex java codes in order to perform data analysis.<\/p>\n<p>Apache Pig provides a high-level language known as Pig Latin which helps Hadoop developers to write data analysis programs. By using various operators provided by Pig Latin language programmers can develop their own functions for reading, writing, and processing data.<\/p>\n<p>In order to perform analysis using Apache Pig, programmers have to write scripts using Pig Latin language to process data stored in Hadoop Distributed File System. Internally, all these scripts are converted to Map and Reduce tasks.<\/p>\n<p>A component known as Pig Engine is present inside Apache Pig in which Pig Latin scripts are taken as input and these scripts gets converted into Map-Reduce jobs.<\/p>\n<h3>c. Need for\u00a0Pig<\/h3>\n<p>For all those Programmers who are not so good at Java normally, have to struggle a lot for working with Hadoop, especially when they need to perform any MapReduce tasks. Apache Pig comes up as a helpful tool for all such programmers.<\/p>\n<p>There is no need of developing\u00a0complex Java codes to perform MapReduce tasks. By simply writing Pig Latin scripts programmers can now easily perform MapReduce tasks without having need of writing\u00a0complex codes in Java.<\/p>\n<p>Apache Pig reduces the length of codes by using multi-query approach. For example, to perform an operation we need to write\u00a0200 lines of code in Java that we can easily perform just by typing less than 10 lines of code in Apache Pig.<\/p>\n<p>Hence, ultimately our almost 16 times development time gets reduced using Apache Pig.<\/p>\n<p>If developers have knowledge of SQL language, then it is very easy to learn Pig Latin language as it is similar to SQL language.<\/p>\n<p>Many built-in operators are provided by Apache Pig to support data operations like filters, joins, ordering, etc. In addition, nested data types like tuples, bags, and maps which are not present in MapReduce are also provided by Pig.<\/p>\n<h3>d. Features of Pig<\/h3>\n<p>Apache Pig comes with the below unique features:<\/p>\n<div id=\"attachment_14579\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Features-of-Pig-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-14579\" class=\"wp-image-14579 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Features-of-Pig-01.jpg\" alt=\"Apache-Pig-features\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Features-of-Pig-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Features-of-Pig-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Features-of-Pig-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Features-of-Pig-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Features-of-Pig-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-14579\" class=\"wp-caption-text\">Apache Pig Features<\/p><\/div>\n<p><strong>Rich Set of Operators:<\/strong> Pig consists of a collection of rich set of operators in order to perform operations such as join, filer, sort and many more.<\/p>\n<p><strong>Ease of Programming:<\/strong> Pig Latin is similar to SQL and hence it becomes very easy for developers to write a Pig script. If you have knowledge of SQL language, then it is very easy to learn Pig Latin language as it is similar to SQL language.<\/p>\n<p><strong>Optimization opportunities:<\/strong> The execution of the task in Apache Pig gets automatically optimized by the task itself, hence the programmers need to only focus on the semantics of the language.<\/p>\n<p><strong>Extensibility:<\/strong> By using the existing operators, users can easily develop their own functions to read, process, and write data.<\/p>\n<p><strong>User Define Functions (UDF\u2019s<\/strong>): With the help of facility provided by Pig of creating UDF\u2019s, we can easily create User Defined Functions on a number of programming languages such as Java and invoke or embed them in Pig Scripts.<\/p>\n<p><strong>All types of data handling:<\/strong> Analysis of all types of Data (i.e. both structured as well as unstructured) is provided by Apache Pig and the results are stored inside HDFS.<\/p>\n<h2>Conclusion<\/h2>\n<p>So finally we have seen what is Apache Pig, Pig History, Why Pig is required and the key features of Apache Pig that make it different from other similar technologies.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This Apache Pig tutorial provides the basic introduction to Apache Pig &#8211; high-level tool\u00a0over MapReduce. This tutorial helps professionals who are working on Hadoop and would like to perform MapReduce operations using a high-level&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":42764,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[863,877,888,1907,1971,2590,5305,9493,9509],"class_list":["post-770","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pig","tag-apache-pig","tag-apache-pig-introduction-tutorial","tag-apache-pig-tutorial","tag-big-data","tag-big-data-training","tag-cloudera-pig","tag-hadoop-pig","tag-pig","tag-pig-introduction"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Apache Pig Tutorial - An Introduction guide - DataFlair<\/title>\n<meta name=\"description\" content=\"Apache Pig tutorial-Apache Pig Introduction, what is Apache Pig, Apache Pig history, need of Apache Pig, Apache Pig features that make it different.\" \/>\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-tutorial-introduction-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apache Pig Tutorial - An Introduction guide - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Apache Pig tutorial-Apache Pig Introduction, what is Apache Pig, Apache Pig history, need of Apache Pig, Apache Pig features that make it different.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/\" \/>\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=\"2016-08-03T09:58:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/08\/Apache-Pig-Tutorial-01.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=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Apache Pig Tutorial - An Introduction guide - DataFlair","description":"Apache Pig tutorial-Apache Pig Introduction, what is Apache Pig, Apache Pig history, need of Apache Pig, Apache Pig features that make it different.","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-tutorial-introduction-guide\/","og_locale":"en_US","og_type":"article","og_title":"Apache Pig Tutorial - An Introduction guide - DataFlair","og_description":"Apache Pig tutorial-Apache Pig Introduction, what is Apache Pig, Apache Pig history, need of Apache Pig, Apache Pig features that make it different.","og_url":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2016-08-03T09:58:24+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/08\/Apache-Pig-Tutorial-01.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Apache Pig Tutorial &#8211; An Introduction guide","datePublished":"2016-08-03T09:58:24+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/"},"wordCount":683,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/08\/Apache-Pig-Tutorial-01.jpg","keywords":["apache pig","apache pig introduction tutorial","Apache Pig tutorial","big data","big data training","cloudera pig","hadoop pig","pig","pig introduction"],"articleSection":["Pig Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/","url":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/","name":"Apache Pig Tutorial - An Introduction guide - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/08\/Apache-Pig-Tutorial-01.jpg","datePublished":"2016-08-03T09:58:24+00:00","description":"Apache Pig tutorial-Apache Pig Introduction, what is Apache Pig, Apache Pig history, need of Apache Pig, Apache Pig features that make it different.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/08\/Apache-Pig-Tutorial-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/08\/Apache-Pig-Tutorial-01.jpg","width":1200,"height":628,"caption":"Introduction to Pig Training Tutorial DataFlair"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/apache-pig-tutorial-introduction-guide\/#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":"Apache Pig Tutorial &#8211; An Introduction guide"}]},{"@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\/770","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=770"}],"version-history":[{"count":0,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/770\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/42764"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}