<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Fetch distinct values of a column in Dataframe using Spark in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Fetch-distinct-values-of-a-column-in-Dataframe-using-Spark/m-p/174636#M136899</link>
    <description>&lt;P&gt;Yes i have 1 fat jar that has all the dependencies. The thing is when i use &lt;STRONG&gt;collect() &lt;/STRONG&gt;in my below code it works on yarn-cluster. &lt;STRONG&gt;But using collect() removes parallelism on further operations, so i don want to use collect&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Without using collect() statement i get "java.lang.NoClassDefFoundError" exception as mentioned above.
&lt;STRONG&gt;The below code on local mode works fine without collect statement.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Please help me understand this behavior.&lt;/P&gt;&lt;PRE&gt;   preProcessedDataFrame.registerTempTable("tApplication")
      preProcessedDataFrame.select(ApplicationId).distinct().&lt;STRONG&gt;collect()&lt;/STRONG&gt;.foreach(record =&amp;gt; {
      val applicationId = record.getAs[String](ApplicationId)
      val selectedApplicationDataFrame = sqlContext.sql("SELECT * FROM tApplication WHERE ApplicationId = " + applicationId)
      logger.info("selectedApplicationId: " +  applicationId)
      //DO FURTHER PROCESSSING on selectedApplicationDataFrame.....
      })

&lt;/PRE&gt;</description>
    <pubDate>Tue, 16 Aug 2016 01:51:37 GMT</pubDate>
    <dc:creator>kaz_narasimhan</dc:creator>
    <dc:date>2016-08-16T01:51:37Z</dc:date>
  </channel>
</rss>

