flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sachin Goel <sachingoel0...@gmail.com>
Subject Re: Run Time Exception
Date Sun, 19 Jul 2015 14:56:16 GMT
Hi
You do not need to call env.execute after doing a print call. Print itself
triggers the execution. The reason for the Exception is quite obvious.
After the print call, there is no sink for the program execution. So,
execution cannot proceed.
You can however explicitly define a sink and then call env.execute.

Cheers!
Sachin

-- Sachin Goel
Computer Science, IIT Delhi
m. +91-9871457685

On Sun, Jul 19, 2015 at 8:06 PM, Madabhattula Rajesh Kumar <
mrajaforu@gmail.com> wrote:

> Hi,
>
> I have written simple wordcount program in scala. When I execute the
> program, I'm getting below exception.
>
> Please let me know how to fix this issue. I'm using Flink 0.9.0 version
>
> *Below is the program :-*
>
>     val env = ExecutionEnvironment.getExecutionEnvironment
>     // get input data
>     val text = env readTextFile("/Users/hadoop2/Data/word.txt")
>     val counts = text flatMap(l=>l split(" ")) map(word=>(word,1))
> groupBy(0) sum(1)
>     // emit result
>     counts print
>     env.execute("TEST")
>
> *Exception :-*
>
> Exception in thread "main" java.lang.RuntimeException: No new data sinks
> have been defined since the last execution. The last execution refers to
> the latest call to 'execute()', 'count()', 'collect()', or 'print()'.
>     at
> org.apache.flink.api.java.ExecutionEnvironment.createProgramPlan(ExecutionEnvironment.java:910)
>     at
> org.apache.flink.api.java.ExecutionEnvironment.createProgramPlan(ExecutionEnvironment.java:893)
>     at
> org.apache.flink.api.java.LocalEnvironment.execute(LocalEnvironment.java:50)
>     at
> org.apache.flink.api.scala.ExecutionEnvironment.execute(ExecutionEnvironment.scala:590)
>     at WordCount$.main(WordCount.scala:17)
>     at WordCount.main(WordCount.scala)
>
> Regards,
> Rajesh
>

Mime
View raw message