I just tested the zipWithIndex method with Flink 0.10.1 and it worked. I used the following code:
import org.apache.flink.api.scala._ import org.apache.flink.api.scala.utils._ object Job { def main(args: Array[String]): Unit = { val env = ExecutionEnvironment.getExecutionEnvironment val input = env.fromElements(1,2,3,4,5,6,7) val result = input.zipWithIndex result.print() } } Cheers, Till On Sat, Dec 12, 2015 at 8:48 PM, Filip Łęczycki <filipleczy...@gmail.com> wrote: > Hi Marton, > > Thank you for your answer. I wasn't able to use zipWithIndex in a way that > you stated as i got "cannot resolve" error. However it worked when i used > it like this: > > val utils = new DataSetUtils[AlignmentRecord](data) > val index = utils.zipWithIndex > > Regards, > Filip Łęczycki > > Pozdrawiam, > Filip Łęczycki > > 2015-12-12 19:56 GMT+01:00 Márton Balassi <balassi.mar...@gmail.com>: > >> Hey Filip, >> >> As you are using the scala API it is easier to use the Scala DataSet >> utils, which are accessible after the following import: >> >> import org.apache.flink.api.scala.utils._ >> >> Then you can do the following: >> >> val indexed = data.zipWithIndex >> >> Best, >> >> Marton >> >> >> On Sat, Dec 12, 2015 at 7:48 PM, Filip Łęczycki <filipleczy...@gmail.com> >> wrote: >> >>> Hi all, >>> >>> I tried to use ZipWithIndex functionality, accordingly to the Scala >>> examples posted here: >>> >>> https://ci.apache.org/projects/flink/flink-docs-master/apis/zip_elements_guide.html >>> >>> however I am not able to call the mentioned function because it cannot >>> be resolved. I checked the flink code >>> for org.apache.flink.api.scala.DataSet and there is no such function. I am >>> using the latest version, 0.10.1. Was it removed or moved to different >>> module? Is there any way to use it? >>> >>> When i try to use the function from DataSetUtils java module: >>> >>> data is of type DataSet[AlignmentRecord] >>> val indexed = DataSetUtils.zipWithIndex[AlignmentRecord](data) >>> >>> I receive following error: >>> Type mismatch: expected: DataSet[AlignmentRecord], actual: >>> DataSet[AlignmentRecord] >>> >>> Could you please guide me how to use this function? >>> >>> Pozdrawiam, >>> Filip Łęczycki >>> >> >> >