Alexey Grigorev Alexey Grigorev - 5 months ago 51
Scala Question

zipWithIndex on Apache Flink

I'd like to assign each row of my input an

- which should be a number from
N - 1
, where
is the number of rows in the input.

Roughly, I'd like to be able to do something like the following :

val data = sc.textFile(textFilePath, numPartitions)
val rdd = => process(line))
val rddMatrixLike = { case (v, idx) => someStuffWithIndex(idx, v) }

But in Apache Flink. Is it possible?


This is now a part of the 0.10-SNAPSHOT release of Apache Flink. Examples for zipWithIndex(in) and zipWithUniqueId(in) are available in the official Flink documentation.