{"id":15533,"date":"2014-09-15T17:08:23","date_gmt":"2014-09-15T11:38:23","guid":{"rendered":"https:\/\/2thenew.xyz\/blog\/?p=15533"},"modified":"2016-11-29T16:55:22","modified_gmt":"2016-11-29T11:25:22","slug":"how-to-use-groupby-and-join-in-apache-spark","status":"publish","type":"post","link":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/","title":{"rendered":"Usage of GroupBy and Join in Apache Spark"},"content":{"rendered":"<p>Using GroupBy and JOIN is often very challenging.\u00a0Recently in one of the POCs of <a title=\"MEAN web development\" href=\"https:\/\/2thenew.xyz\/mean-stack-web-development-consulting\" target=\"_blank\">MEAN project<\/a>, I used groupBy and join in apache spark.<\/p>\n<p>I had two\u00a0datasets in hdfs,\u00a0one for the sales and other for the product.<\/p>\n<p>Sales Datasets column : Sales Id, Version, Brand Name, Product Id, No of Item Purchased, Purchased Date<\/p>\n<p>Product Datasets columns : Product Id, Version, Brand Name, Category, Price, Product Name, Weight<\/p>\n<p>I wanted to calculate the total sales by year. So for this, I applied\u00a0the join between the 2 datasets i.e. sales and product on the basis of the productId. I used\u00a0groupBy on the joined\u00a0datasets on the basis of year to calculate the Total Sales by year.<\/p>\n<p>For this, you need to create a <a href=\"https:\/\/2thenew.xyz\/blog\/overview-of-database-testing\/\">database<\/a> named as sales, and import the sales.sql file into mysql<\/p>\n<p>You need to use sqoop to import the data into hdfs.<\/p>\n<p>Command : sqoop import-all-tables &#8211;connect jdbc:mysql:\/\/localhost\/sales &#8211;username root &#8211;warehouse-dir \/user\/data\/input-data\/user\/<\/p>\n<p>For sale: hdfs location \u00a0: \/user\/data\/input-data\/user\/sale<\/p>\n<p>For Products: hdfs location : \/user\/data\/input-data\/user\/product<\/p>\n<p>Then you have to use following code for join and groupBy.<\/p>\n<p>[java]package com.spark.test;<\/p>\n<p>import org.apache.spark.api.java.JavaPairRDD;<br \/>\nimport org.apache.spark.api.java.JavaRDD;<br \/>\nimport org.apache.spark.api.java.JavaSparkContext;<br \/>\nimport org.apache.spark.api.java.function.*;<br \/>\nimport scala.Tuple2;<\/p>\n<p>import java.text.SimpleDateFormat;<br \/>\nimport java.util.ArrayList;<br \/>\nimport java.util.Calendar;<br \/>\nimport java.util.Date;<br \/>\nimport java.util.List;<br \/>\nimport java.util.regex.Pattern;<\/p>\n<p>\/**<br \/>\n * Created by mohit on 3\/9\/14.<br \/>\n *\/<br \/>\npublic class TotalSales {<br \/>\n    private static final Pattern SPACE = Pattern.compile(&quot; &quot;);<\/p>\n<p>    public static void main(String args[]) {<br \/>\n        JavaSparkContext ctx = new JavaSparkContext(&quot;local[*]&quot;, &quot;TotalSales&quot;, System.getenv(&quot;SPARK_HOME&quot;), JavaSparkContext.jarOfClass(TotalSales.class));<br \/>\n        final Calendar c = Calendar.getInstance();<\/p>\n<p>        JavaPairRDD&lt;String, Product&gt; productJavaPairRDD = fetchProductData(ctx);<br \/>\n        JavaPairRDD&lt;String, Sale&gt; saleJavaPairRDD = fetchSalesData(ctx);<br \/>\n        JavaPairRDD&lt;String, Tuple2&lt;Product, Sale&gt;&gt; joinData = productJavaPairRDD.join(saleJavaPairRDD);<br \/>\n        JavaRDD productSaleMap = fetchFlatMap(joinData);<br \/>\n        JavaPairRDD&lt;Object, Iterable&gt; groupMap = productSaleMap.groupBy(new Function&lt;ProductSale, Object&gt;() {<br \/>\n            @Override<br \/>\n            public Object call(ProductSale productSale) throws Exception {<br \/>\n                c.setTime(productSale.getSale().getPurchaseDate());<br \/>\n                return c.get(Calendar.YEAR);<br \/>\n            }<br \/>\n        });<\/p>\n<p>        JavaPairRDD&lt;Object, Long&gt; totalSaleData = groupMap.mapValues(new Function&lt;Iterable, Long&gt;() {<br \/>\n            @Override<br \/>\n            public Long call(Iterable productSales) throws Exception {<br \/>\n                Long sumData = 0L;<br \/>\n                for (ProductSale productSale : productSales) {<br \/>\n                    sumData = sumData + (productSale.getProduct().getPrice() * productSale.getSale().getItemPurchased());<br \/>\n                }<br \/>\n                return sumData;<br \/>\n            }<br \/>\n        });<\/p>\n<p>        List&lt;Tuple2&lt;Object, Long&gt;&gt; collectData = totalSaleData.sortByKey().collect();<br \/>\n        System.out.println(&quot;Collect DAta:::::&quot;+collectData);<\/p>\n<p>        ctx.stop();<br \/>\n    }<\/p>\n<p>    static JavaRDD fetchFlatMap(JavaPairRDD&lt;String, Tuple2&lt;Product, Sale&gt;&gt; joinData) {<br \/>\n        JavaRDD productSaleMap = joinData.flatMap(new FlatMapFunction&lt;Tuple2&lt;String, Tuple2&lt;Product, Sale&gt;&gt;, ProductSale&gt;() {<br \/>\n            @Override<br \/>\n            public Iterable call(Tuple2&lt;String, Tuple2&lt;Product, Sale&gt;&gt; tuple) throws Exception {<br \/>\n                ProductSale productSale = new ProductSale();<br \/>\n                productSale.setProductId(tuple._1());<br \/>\n                productSale.setSale(tuple._2()._2());<br \/>\n                productSale.setProduct(tuple._2()._1());<br \/>\n                List productSaleList = new ArrayList();<br \/>\n                productSaleList.add(productSale);<br \/>\n                return productSaleList;<br \/>\n            }<br \/>\n        });<br \/>\n        return productSaleMap;<br \/>\n    }<\/p>\n<p>    static JavaPairRDD&lt;String, Product&gt; fetchProductData(JavaSparkContext ctx) {<\/p>\n<p>        JavaRDD lines = ctx.textFile(&quot;hdfs:\/\/localhost:9000\/user\/data\/input-data\/user\/product\/part-*&quot;, 1);<\/p>\n<p>        JavaRDD&lt;String[]&gt; splitMap = lines.map(new Function&lt;String, String[]&gt;() {<br \/>\n            @Override<br \/>\n            public String[] call(String s) throws Exception {<br \/>\n                return s.split(&quot;\\t&quot;);<br \/>\n            }<br \/>\n        });<\/p>\n<p>        JavaPairRDD&lt;String, Product&gt; mapKey = splitMap.mapToPair(new PairFunction&lt;String[], String, Product&gt;() {<br \/>\n            @Override<br \/>\n            public Tuple2&lt;String, Product&gt; call(String[] strings) throws Exception {<br \/>\n                String[] dataArray = strings[0].split(&quot;,&quot;);<br \/>\n                Product product = new Product();<br \/>\n                product.setProductId(Long.getLong(dataArray[0]));<br \/>\n                product.setBrandName(dataArray[2]);<br \/>\n                product.setCategory(dataArray[3]);<br \/>\n                product.setPrice(Integer.parseInt(dataArray[4]));<br \/>\n                product.setProductName(dataArray[5]);<br \/>\n                product.setWeight(dataArray[6]);<br \/>\n                return new Tuple2&lt;String, Product&gt;(dataArray[0], product);<br \/>\n            }<br \/>\n        });<br \/>\n        return mapKey;<br \/>\n    }<\/p>\n<p>    static JavaPairRDD&lt;String, Sale&gt; fetchSalesData(JavaSparkContext ctx) {<br \/>\n        JavaRDD salesLines = ctx.textFile(&quot;hdfs:\/\/localhost:9000\/user\/data\/input-data\/user\/sale\/part-*&quot;, 1);<\/p>\n<p>        JavaRDD&lt;String[]&gt; salesLineMap = salesLines.map(new Function&lt;String, String[]&gt;() {<br \/>\n            @Override<br \/>\n            public String[] call(String s) throws Exception {<br \/>\n                return s.split(&quot;\\t&quot;);<br \/>\n            }<br \/>\n        });<\/p>\n<p>        JavaPairRDD&lt;String, Sale&gt; salesMapKey = salesLineMap.mapToPair(new PairFunction&lt;String[], String, Sale&gt;() {<br \/>\n            @Override<br \/>\n            public Tuple2&lt;String, Sale&gt; call(String[] strings) throws Exception {<br \/>\n                String[] dataArray = strings[0].split(&quot;,&quot;);<br \/>\n                String date_s = dataArray[5];<br \/>\n                SimpleDateFormat dt = new SimpleDateFormat(&quot;yyyyy-mm-dd hh:mm:ss&quot;);<br \/>\n                Date date = dt.parse(date_s);<br \/>\n                Sale product = new Sale();<br \/>\n                product.setProductId(Long.getLong(dataArray[4]));<br \/>\n                product.setBrandName(dataArray[2]);<br \/>\n                product.setItemPurchased(Long.parseLong(dataArray[3]));<br \/>\n                product.setPurchaseDate(dt.parse(date_s));<br \/>\n                return new Tuple2&lt;String, Sale&gt;(dataArray[4], product);<br \/>\n            }<br \/>\n        });<br \/>\n        return salesMapKey;<br \/>\n    }<br \/>\n}<br \/>\n[\/java]<\/p>\n<p>This line is\u00a0used for the join the product and sale data on the basis of productId:<\/p>\n<p>[java]<br \/>\n JavaPairRDD&lt;String, Tuple2&lt;Product, Sale&gt;&gt; joinData = productJavaPairRDD.join(saleJavaPairRDD);<br \/>\n[\/java]<\/p>\n<p>For GroupBy:<\/p>\n<p>[java]<br \/>\nJavaPairRDD&lt;Object, Iterable&gt; groupMap = productSaleMap.groupBy(new Function&lt;ProductSale, Object&gt;() {<br \/>\n            @Override<br \/>\n            public Object call(ProductSale productSale) throws Exception {<br \/>\n                c.setTime(productSale.getSale().getPurchaseDate());<br \/>\n                return c.get(Calendar.YEAR);<br \/>\n            }<br \/>\n        });<br \/>\n[\/java]<\/p>\n<p>For complete source code:<\/p>\n<p>github location : \u00a0git@github.com:IntelliGrape\/bigdata-poc.git<\/p>\n<p>Hope this will give you a\u00a0better idea about &#8220;join and group by&#8221; in Apache Spark.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using GroupBy and JOIN is often very challenging.\u00a0Recently in one of the POCs of MEAN project, I used groupBy and join in apache spark. I had two\u00a0datasets in hdfs,\u00a0one for the sales and other for the product. Sales Datasets column : Sales Id, Version, Brand Name, Product Id, No of Item Purchased, Purchased Date Product [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":12,"footnotes":""},"categories":[1395],"tags":[1515,1398,1516,1517],"class_list":["post-15533","post","type-post","status-publish","format-standard","hentry","category-big-data","tag-apache-spark","tag-hadoop","tag-hdfs","tag-sqoop"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Mohit Garg\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#article\",\"name\":\"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog\",\"headline\":\"Usage of GroupBy and Join in Apache Spark\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2014-09-15T17:08:23+05:30\",\"dateModified\":\"2016-11-29T16:55:22+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#webpage\"},\"articleSection\":\"Big Data, Apache Spark, hadoop, HDFS, Sqoop\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/big-data\\\/#listItem\",\"name\":\"Big Data\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/big-data\\\/#listItem\",\"position\":2,\"name\":\"Big Data\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/big-data\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#listItem\",\"name\":\"Usage of GroupBy and Join in Apache Spark\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#listItem\",\"position\":3,\"name\":\"Usage of GroupBy and Join in Apache Spark\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/big-data\\\/#listItem\",\"name\":\"Big Data\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit\\\/\",\"name\":\"Mohit Garg\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/931ccdefca3a3ec5366d4652824c2e03776befb43ae29205264bc46a3ec45d0a?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Mohit Garg\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/\",\"name\":\"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog\",\"description\":\"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/how-to-use-groupby-and-join-in-apache-spark\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit\\\/#author\"},\"datePublished\":\"2014-09-15T17:08:23+05:30\",\"dateModified\":\"2016-11-29T16:55:22+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog","description":"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.","canonical_url":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#article","name":"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog","headline":"Usage of GroupBy and Join in Apache Spark","author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/mohit\/#author"},"publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"},"datePublished":"2014-09-15T17:08:23+05:30","dateModified":"2016-11-29T16:55:22+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#webpage"},"articleSection":"Big Data, Apache Spark, hadoop, HDFS, Sqoop"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.xyz\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/big-data\/#listItem","name":"Big Data"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/big-data\/#listItem","position":2,"name":"Big Data","item":"https:\/\/2thenew.xyz\/blog\/category\/big-data\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#listItem","name":"Usage of GroupBy and Join in Apache Spark"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#listItem","position":3,"name":"Usage of GroupBy and Join in Apache Spark","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/big-data\/#listItem","name":"Big Data"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.xyz\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.xyz\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.xyz\/blog\/author\/mohit\/#author","url":"https:\/\/2thenew.xyz\/blog\/author\/mohit\/","name":"Mohit Garg","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/931ccdefca3a3ec5366d4652824c2e03776befb43ae29205264bc46a3ec45d0a?s=96&d=mm&r=g","width":96,"height":96,"caption":"Mohit Garg"}},{"@type":"WebPage","@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#webpage","url":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/","name":"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog","description":"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/mohit\/#author"},"creator":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/mohit\/#author"},"datePublished":"2014-09-15T17:08:23+05:30","dateModified":"2016-11-29T16:55:22+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.xyz\/blog\/#website","url":"https:\/\/2thenew.xyz\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog","og:description":"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.","og:url":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/","og:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Usage of GroupBy and Join in Apache Spark | TO THE NEW Blog","twitter:description":"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.","twitter:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"15533","title":"Usage of GroupBy and Join in Apache Spark | #site_title","description":"In this blog, we will help share a scenario in which we guide how to use groupBy and join in apache spark.","keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 15:45:28","updated":"2024-02-29 08:55:24","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\/category\/big-data\/\" title=\"Big Data\">Big Data<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tUsage of GroupBy and Join in Apache Spark\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.xyz\/blog"},{"label":"Big Data","link":"https:\/\/2thenew.xyz\/blog\/category\/big-data\/"},{"label":"Usage of GroupBy and Join in Apache Spark","link":"https:\/\/2thenew.xyz\/blog\/how-to-use-groupby-and-join-in-apache-spark\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/15533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/comments?post=15533"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/15533\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/media?parent=15533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/categories?post=15533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/tags?post=15533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}