Alexey Grigorev Alexey Grigorev - 1 year ago 190
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download