<?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: union rdd with emptyrdd in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40120#M26082</link>
    <description>&lt;P&gt;I have found the solution :&lt;/P&gt;&lt;PRE&gt;var addedRDD : org.apache.spark.rdd.RDD[(String,Int)] = sc.emptyRDD&lt;/PRE&gt;</description>
    <pubDate>Mon, 25 Apr 2016 12:45:34 GMT</pubDate>
    <dc:creator>ghandrisaleh</dc:creator>
    <dc:date>2016-04-25T12:45:34Z</dc:date>
    <item>
      <title>union rdd with emptyrdd</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40117#M26079</link>
      <description>&lt;P&gt;I want to make a union for which RDD who I have in streaming&lt;/P&gt;&lt;P&gt;this is my code :&lt;/P&gt;&lt;PRE&gt;val sc = new SparkContext(conf)   
val ssc = new StreamingContext(sc, Seconds(10))
val file = ssc.textFileStream("hdfs://192.168.1.20:8020/user/sparkStreaming/input")
  var test = file.map(x =&amp;gt; (x.split(";")(0)+";"+x.split(";")(1), 1)).reduceByKey((x,y) =&amp;gt; x+y)
  
  var addedRDD = sc.emptyRDD
  test.foreachRDD{ rdd =&amp;gt;
  addedRDD = addedRDD union rdd 
  addedRDD.cache()
}&lt;/PRE&gt;&lt;P&gt;but I have this error :&lt;/P&gt;&lt;PRE&gt;type mismatch; found : org.apache.spark.rdd.RDD[(String, Int)] required: org.apache.spark.rdd.RDD[Nothing]&lt;/PRE&gt;&lt;P&gt;And when I try&amp;nbsp;to create an empty RDD with a given type, I have this error :&lt;/P&gt;&lt;PRE&gt;type mismatch; found : org.apache.spark.rdd.RDD[(String, Int)] required: org.apache.spark.rdd.EmptyRDD[(String, Int)]&lt;/PRE&gt;&lt;P&gt;How can I fix this problem?&lt;/P&gt;&lt;P&gt;thanks in advance !!!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:15:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40117#M26079</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2022-09-16T10:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: union rdd with emptyrdd</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40118#M26080</link>
      <description>&lt;P&gt;Try "sc.emptyRDD[(String,Int)]"; currently the type of the RDD is not inferrable and so isn't obviously a match for the ones that it's unioned to later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, you really want to use SparkContext.union here to union many RDDs. Make a Seq of them and then call once to union them.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 12:02:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40118#M26080</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2016-04-25T12:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: union rdd with emptyrdd</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40119#M26081</link>
      <description>some code that I understand please</description>
      <pubDate>Mon, 25 Apr 2016 12:22:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40119#M26081</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2016-04-25T12:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: union rdd with emptyrdd</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40120#M26082</link>
      <description>&lt;P&gt;I have found the solution :&lt;/P&gt;&lt;PRE&gt;var addedRDD : org.apache.spark.rdd.RDD[(String,Int)] = sc.emptyRDD&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Apr 2016 12:45:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/union-rdd-with-emptyrdd/m-p/40120#M26082</guid>
      <dc:creator>ghandrisaleh</dc:creator>
      <dc:date>2016-04-25T12:45:34Z</dc:date>
    </item>
  </channel>
</rss>

