readTextFile is not working for StreamExecutionEnvironment

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

readTextFile is not working for StreamExecutionEnvironment

Balaji Rajagopalan
def main(args: Array[String]): Unit = {



val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
try {

val data1:DataStream[String] = env.readTextFile(“somefile.txt”);
    data1.print()
  }
  catch {
    case e: Exception => println(e)
}
}
I have non empty file that this does not print anything. 

         
Reply | Threaded
Open this post in threaded view
|

Re: readTextFile is not working for StreamExecutionEnvironment

rmetzger0
Hi,
you need to explicitly trigger the execution by calling "env.execute()"

On Wed, Mar 2, 2016 at 1:36 PM, Balaji Rajagopalan <[hidden email]> wrote:
def main(args: Array[String]): Unit = {



val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
try {

val data1:DataStream[String] = env.readTextFile(“somefile.txt”);
    data1.print()
  }
  catch {
    case e: Exception => println(e)
}
}
I have non empty file that this does not print anything. 

         

Reply | Threaded
Open this post in threaded view
|

Re: readTextFile is not working for StreamExecutionEnvironment

Maximilian Michels
In reply to this post by Balaji Rajagopalan
Hi Balaji,

You forgot to execute your Flink program using

env.execute();

Cheers,
Max

On Wed, Mar 2, 2016 at 1:36 PM, Balaji Rajagopalan
<[hidden email]> wrote:

> def main(args: Array[String]): Unit = {
>
>
>
>   val env: StreamExecutionEnvironment =
> StreamExecutionEnvironment.getExecutionEnvironment();
>   env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
>   try {
>
>     val data1:DataStream[String] = env.readTextFile(“somefile.txt”);
>
>     data1.print()
>
>   }
>
>   catch {
>
>     case e: Exception => println(e)
>   }
>
> }
>
> I have non empty file that this does not print anything.
>
>
>