title: Scala Spark Map DataFrame Missing Paramenter Type
body: <p>I am new to Spark and receiving an error in when I map a Dataframe.</p>
  
  <p>I have a DStream and I want to transform it using a sql Dataframe to filter the data. The code is like this: </p>
  
  <pre><code>  val textDStream = ssc.textFileStream(inputPath)
    val activityStream = textDStream.transform(input =&gt; {
      input.flatMap { line =&gt;
        val record = line.split("\\t")
        Some(Activity(record(0).toLong / MS_IN_HOUR * MS_IN_HOUR, record(1), record(2), record(3), record(4), record(5), record(6)))
        }
    })
  
  activityStream.transform(rdd =&gt; {
  
      val df = rdd.toDF()
  
      df.registerTempTable("activity")
      val activityByProduct = sqlContext.sql("""SELECT
                                          product,
                                          timestamp_hour,
                                          sum(case when action = 'purchase' then 1 else 0 end) as purchase_count,
                                          sum(case when action = 'add_to_cart' then 1 else 0 end) as add_to_cart_count,
                                          sum(case when action = 'page_view' then 1 else 0 end) as page_view_count
                                          from activity
                                          group by product, timestamp_hour """)
  
      activityByProduct
        .map { r =&gt; ((r.getString(0), r.getLong(1)),
          ActivityByProduct(r.getString(0), r.getLong(1), r.getLong(2), r.getLong(3), r.getLong(4))
          )}
  
    }).print()
  </code></pre>
  
  <p>The problem here is that I receive the following error: </p>
  
  <blockquote>
    <p>Error:(58, 18) missing parameter type
              .map { r => ((r.getString(0), r.getLong(1)),</p>
  </blockquote>
  
  <pre><code>activityByProduct
    .map { r =&gt; ((r.getString(0), r.getLong(1)),
      ActivityByProduct(r.getString(0), r.getLong(1), r.getLong(2), r.getLong(3), r.getLong(4))
      )}
  </code></pre>
  
  <p>I cannot seen where the type is missing. I have already tried to explicitilly set r => type. But it continues to return the error.</p>
  
  <p>What could it be ?</p>
  
  <p>Thanks in advance</p>