Hi Nida,

The StreamExecutionEnvironment#fromCollection(java.util.Collection<OUT>
data) method will check if the input collection is empty and throw the
exception you have met if it is.
The 'list != null' cannot get rid of the exception but the '
!list.isEmpty() '  should do the trick.
Could you please show your codes with the ' !list.isEmpty() ' check?

Best,
Biao Geng

Fidea Lidea <lideafidea...@gmail.com> 于2024年4月2日周二 02:06写道:

> Hi Team,
>
> I have written a Flink Job which reads data in a List & then converts it
> to stream.
> *Example*:
>
>  public static void main(String[] args) throws Exception {
>   // set up execution environment
>   StreamExecutionEnvironment env =
> StreamExecutionEnvironment.getExecutionEnvironment();
> . . .
>  List<DTO> list=processData( );
>   DataStream<DTO> orderA = env.fromCollection(list);
>   . . . .
>   env.execute("Job");
>   }
>
> If *list* is empty then code throws below exception on Flink UI & does
> not execute the Job. How can I handle this?
> I've tried using list != null or list ! = isEmpty() checks. But it
> didn't work. Request to provide suggestions.
>
> *Exception : *
>
> [image: image.png]
>
> Thanks  & Regards
> Nida
>
>

Reply via email to