{"id":226,"date":"2017-09-29T08:48:51","date_gmt":"2017-09-29T08:48:51","guid":{"rendered":"http:\/\/techvidvan.com\/tutorials\/?p=226"},"modified":"2017-09-29T08:48:51","modified_gmt":"2017-09-29T08:48:51","slug":"hadoop-mapper-class-mapreduce","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/","title":{"rendered":"What is Hadoop Mapper Class in MapReduce?"},"content":{"rendered":"<p>In this blog, we will provide you the complete introduction of <strong>Hadoop Mapper<\/strong>. I<\/p>\n<p>In this blog, we will answer what is Mapper in Hadoop MapReduce, how hadoop mapper works, what are the process of mapper in Mapreduce, how Hadoop generates Key-value pair in MapReduce.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/11\/mapper-in-Mapreduce.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-73203\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/11\/mapper-in-Mapreduce.jpg\" alt=\"Mapper in Hadoop MapReduce\" width=\"1200\" height=\"628\" \/><\/a><\/p>\n<h3>Introduction to Hadoop Mapper<\/h3>\n<p><strong>Hadoop Mapper<\/strong> processes input record produced by the <strong>RecordReader<\/strong> and generates intermediate key-value pairs. The intermediate output is completely different from the input pair.<\/p>\n<p>The output of the mapper is the full collection of key-value pairs. Before writing the output for each mapper task, partitioning of output take place on the basis of the key. Thus partitioning itemizes that all the values for each key are grouped together.<\/p>\n<p>Hadoop MapReduce generates one map task for each InputSplit.<\/p>\n<p>Hadoop MapReduce only understands key-value pairs of data. So, before sending data to the mapper, Hadoop framework should covert data into the key-value pair.<\/p>\n<h3>How is key-value pair generated in Hadoop?<\/h3>\n<p>As we have understood what is mapper in hadoop, now we will discuss how Hadoop generate key-value pair?<\/p>\n<ul>\n<li><strong>InputSplit \u2013\u00a0<\/strong>It is the logical representation of data generated by the <strong>InputFormat.<\/strong> In MapReduce program, it describes a unit of work that contains a single map task.<\/li>\n<li><strong>RecordReader-\u00a0<\/strong>It communicates with the inputSplit. And then converts the data into key-value pairs suitable for reading by the Mapper. RecordReader by default uses TextInputFormat to convert data into the key-value pair.<\/li>\n<\/ul>\n<h3>Mapper Process in Hadoop MapReduce<\/h3>\n<p><strong>InputSplit<\/strong> converts\u00a0the physical representation of the blocks into logical for the Mapper. For example, to read the 100MB file, it will require 2 InputSplit. For each block, the framework creates one InputSplit. Each InputSplit create one mapper.<\/p>\n<p>MapReduce InputSplit not always depends on the number of <strong>data blocks<\/strong>. We can change the number of a split by setting <em><strong>mapred.max.split.size property<\/strong> <\/em>during job execution.<\/p>\n<p>MapReduce RecordReader is responsible for reading\/converting data into key-value pairs till the end of the file. RecordReader assigns Byte offset to each line present in the file.<\/p>\n<p>Then\u00a0Mapper\u00a0receives\u00a0this key\u00a0pair. Mapper produces the intermediate output (key-value pairs which are understandable to reduce).<\/p>\n<h4>How many Map task in Hadoop?<\/h4>\n<p>The number of map tasks depends on the total number of blocks of the input files. In MapReduce map, the right level of parallelism seems to be around 10-100 maps\/node. But there is 300 map for CPU-light map tasks.<\/p>\n<p>For example, we have a block size of 128 MB. And we expect 10TB of input data. Thus it produces 82,000 maps. Hence the number of maps depends on InputFormat.<\/p>\n<p><strong>Mapper = (total data size)\/ (input split size)<\/strong><\/p>\n<p><strong>Example\u00a0<\/strong>&#8211; data size is 1 TB. Input split size is 100 MB.<\/p>\n<p>Mapper = (1000*1000)\/100 = 10,000<\/p>\n<h3>Conclusion<\/h3>\n<p>Hence, Mapper in Hadoop takes a set of data and converts it into another set of data. Thus, it breaks individual elements into tuples (key\/value pairs).<\/p>\n<p>Hope you like this block, if you have any query for Hadoop mapper, so please leave a comment in a section given below. We will be happy to solve them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we will provide you the complete introduction of Hadoop Mapper. I In this blog, we will answer what is Mapper in Hadoop MapReduce, how hadoop mapper works, what are the process&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":73203,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[570],"tags":[538,457,541,568,543,569],"class_list":["post-226","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mapreduce","tag-apache-hadoop","tag-big-data","tag-hadoop","tag-hadoop-mapper","tag-hadoop-tutorial","tag-mapper-in-hadoop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is Hadoop Mapper Class in MapReduce? - TechVidvan<\/title>\n<meta name=\"description\" content=\"Hadoop Mapper tutorial cover what is Mapper in hadoop,How Mapper works in mapreduce,Mapper process,MapReduce key-value pair generation,Map task in Hadoop MR\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Hadoop Mapper Class in MapReduce? - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Hadoop Mapper tutorial cover what is Mapper in hadoop,How Mapper works in mapreduce,Mapper process,MapReduce key-value pair generation,Map task in Hadoop MR\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-29T08:48:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/11\/mapper-in-Mapreduce.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=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Hadoop Mapper Class in MapReduce? - TechVidvan","description":"Hadoop Mapper tutorial cover what is Mapper in hadoop,How Mapper works in mapreduce,Mapper process,MapReduce key-value pair generation,Map task in Hadoop MR","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:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/","og_locale":"en_US","og_type":"article","og_title":"What is Hadoop Mapper Class in MapReduce? - TechVidvan","og_description":"Hadoop Mapper tutorial cover what is Mapper in hadoop,How Mapper works in mapreduce,Mapper process,MapReduce key-value pair generation,Map task in Hadoop MR","og_url":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2017-09-29T08:48:51+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/11\/mapper-in-Mapreduce.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"What is Hadoop Mapper Class in MapReduce?","datePublished":"2017-09-29T08:48:51+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/"},"wordCount":508,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/11\/mapper-in-Mapreduce.jpg","keywords":["apache hadoop","big data","hadoop","hadoop mapper","hadoop tutorial","Mapper in Hadoop"],"articleSection":["MapReduce Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/","url":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/","name":"What is Hadoop Mapper Class in MapReduce? - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/11\/mapper-in-Mapreduce.jpg","datePublished":"2017-09-29T08:48:51+00:00","description":"Hadoop Mapper tutorial cover what is Mapper in hadoop,How Mapper works in mapreduce,Mapper process,MapReduce key-value pair generation,Map task in Hadoop MR","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/11\/mapper-in-Mapreduce.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/11\/mapper-in-Mapreduce.jpg","width":1200,"height":628,"caption":"Mapper in Hadoop MapReduce"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/hadoop-mapper-class-mapreduce\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"What is Hadoop Mapper Class in MapReduce?"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=226"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/226\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/73203"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}