You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Cyril Scetbon <cy...@free.fr> on 2016/03/28 05:57:33 UTC

StateSpec raises error "missing arguments for method"

Hi,

I'm testing a sample code and I get this error. Here is the sample code I use :

scala> import org.apache.spark.streaming._
import org.apache.spark.streaming._

scala> def mappingFunction(key: String, value: Option[Int], state: State[Int]): Option[String] = {
     |    Option(key)
     | }
mappingFunction: (key: String, value: Option[Int], state: org.apache.spark.streaming.State[Int])Option[String]

scala> val spec = StateSpec.function(mappingFunction)
<console>:41: error: missing arguments for method mappingFunction;
follow this method with `_' if you want to treat it as a partially applied function
         val spec = StateSpec.function(mappingFunction)
                                       ^
I followed the current documentation https://spark.apache.org/docs/1.6.1/api/java/org/apache/spark/streaming/StateSpec.html

Any idea ?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: StateSpec raises error "missing arguments for method"

Posted by Cyril Scetbon <cy...@free.fr>.
hmm, I finally found that the following syntax works better :

scala> val mappingFunction = (key: String, value: Option[Int], state: State[Int]) => {
     | Option(key)
     | }
mappingFunction: (String, Option[Int], org.apache.spark.streaming.State[Int]) => Option[String] = <function3>

scala> val spec = StateSpec.function(mappingFunction)
spec: org.apache.spark.streaming.StateSpec[String,Int,Int,Option[String]] = StateSpecImpl(<function4>)

This code comes from one of the spark examples. If anyone can explain me the difference between the two.

Regards 
> On Mar 27, 2016, at 23:57, Cyril Scetbon <cy...@free.fr> wrote:
> 
> Hi,
> 
> I'm testing a sample code and I get this error. Here is the sample code I use :
> 
> scala> import org.apache.spark.streaming._
> import org.apache.spark.streaming._
> 
> scala> def mappingFunction(key: String, value: Option[Int], state: State[Int]): Option[String] = {
>     |    Option(key)
>     | }
> mappingFunction: (key: String, value: Option[Int], state: org.apache.spark.streaming.State[Int])Option[String]
> 
> scala> val spec = StateSpec.function(mappingFunction)
> <console>:41: error: missing arguments for method mappingFunction;
> follow this method with `_' if you want to treat it as a partially applied function
>         val spec = StateSpec.function(mappingFunction)
>                                       ^
> I followed the current documentation https://spark.apache.org/docs/1.6.1/api/java/org/apache/spark/streaming/StateSpec.html
> 
> Any idea ?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org