You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by lofifnc <al...@mni.thm.de> on 2015/12/07 10:24:57 UTC

Error when using scala api .fromElements() / .fromCollection()

Hi,

I'm getting an error when using .fromElements() of the
StreamExecutionEnvironment or ExectutionEnvironment of the scala api:

Error:(53, 54) could not find implicit value for evidence parameter of type
org.apache.flink.api.common.typeinfo.TypeInformation[Int]
    val source : DataSet[Int] = env.fromElements[Int](1, 2, 3, 4, 5)
                                                     ^
My code looks like this:
val env = ExecutionEnvironment.createLocalEnvironment(1)
val source : DataSet = env.fromElements(1, 2, 3, 4, 5)

I'm compiling with java 1.7 and using scala 2.10.4

Best, Alex



--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Error-when-using-scala-api-fromElements-fromCollection-tp3938.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.

Re: Error when using scala api .fromElements() / .fromCollection()

Posted by lofifnc <al...@mni.thm.de>.
Thanks!

I should've mentioned that I've seen the FAQ but I didn't notice intellij
deleting the import immediately.
For anyone encountering a similar behavior:
http://stackoverflow.com/questions/11154912/how-to-prevent-intellij-idea-from-deleting-unused-packages
Note that you have uncheck "opitimize imports on the fly" for scala
seperately.

Best, Alex!



--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Error-when-using-scala-api-fromElements-fromCollection-tp3938p3941.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.

Re: Error when using scala api .fromElements() / .fromCollection()

Posted by Márton Balassi <ba...@gmail.com>.
Hey Alex,

Try adding the following import:

import org.apache.flink.streaming.api.scala._

This adds all the implcit utilities that Flink needs to determine type info.

Best,

Marton

On Mon, Dec 7, 2015 at 10:24 AM, lofifnc <al...@mni.thm.de> wrote:

> Hi,
>
> I'm getting an error when using .fromElements() of the
> StreamExecutionEnvironment or ExectutionEnvironment of the scala api:
>
> Error:(53, 54) could not find implicit value for evidence parameter of type
> org.apache.flink.api.common.typeinfo.TypeInformation[Int]
>     val source : DataSet[Int] = env.fromElements[Int](1, 2, 3, 4, 5)
>                                                      ^
> My code looks like this:
> val env = ExecutionEnvironment.createLocalEnvironment(1)
> val source : DataSet = env.fromElements(1, 2, 3, 4, 5)
>
> I'm compiling with java 1.7 and using scala 2.10.4
>
> Best, Alex
>
>
>
> --
> View this message in context:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Error-when-using-scala-api-fromElements-fromCollection-tp3938.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>

Re: Error when using scala api .fromElements() / .fromCollection()

Posted by Stephan Ewen <se...@apache.org>.
Have a look here:
http://flink.apache.org/faq.html#in-scala-api-i-get-an-error-about-implicit-values-and-evidence-parameters

On Mon, Dec 7, 2015 at 10:24 AM, lofifnc <al...@mni.thm.de> wrote:

> Hi,
>
> I'm getting an error when using .fromElements() of the
> StreamExecutionEnvironment or ExectutionEnvironment of the scala api:
>
> Error:(53, 54) could not find implicit value for evidence parameter of type
> org.apache.flink.api.common.typeinfo.TypeInformation[Int]
>     val source : DataSet[Int] = env.fromElements[Int](1, 2, 3, 4, 5)
>                                                      ^
> My code looks like this:
> val env = ExecutionEnvironment.createLocalEnvironment(1)
> val source : DataSet = env.fromElements(1, 2, 3, 4, 5)
>
> I'm compiling with java 1.7 and using scala 2.10.4
>
> Best, Alex
>
>
>
> --
> View this message in context:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Error-when-using-scala-api-fromElements-fromCollection-tp3938.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>