Hi,

Can you post the full stacktrace?

Thanks, Fabian

Am Di., 25. Sep. 2018 um 12:55 Uhr schrieb Alejandro Alcalde <
algu...@gmail.com>:

> Hi,
>
> I am trying to improve the efficiency of this code:
>
> discretized.map(_._2)
>           .name("Map V")
>           .reduce((_, b) ⇒ b)
>           .name("Get Last V")
>
> I am just interested in the last element of discretized.
>
> I've seen this SO question:
> https://stackoverflow.com/questions/45076310/how-to-get-only-the-last-element-of-the-large-dataset-in-flink
>
> I've tried with this code:
>
> discretized.mapPartition(in ⇒ if (!in.hasNext) in.map(_._2) else Seq())
>           .setParallelism(1)
>           .name("Get Last V")
>
> But I am getting this error:
>
> Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>
> Best
>
> *-- Alejandro Alcalde - elbauldelprogramador.com
> <http://elbauldelprogramador.com>*
>

Reply via email to