Class: matlab.compiler.mlspark.RDD Package: matlab.compiler.mlspark
Zip an RDD with generated unique Long IDs
result = zipWithUniqueId(obj)
result = zipWithUniqueId(obj) zips obj with generated unique Long IDs.
result
obj
expand all
RDD
An input RDD, specified as a RDD object.
An output pipelined RDD, returned as a RDD object.
%% Connect to Spark sparkProp = containers.Map({'spark.executor.cores'}, {'1'}); conf = matlab.compiler.mlspark.SparkConf('AppName','myApp', ... 'Master','local[1]','SparkProperties',sparkProp); sc = matlab.compiler.mlspark.SparkContext(conf); %% zipWithUniqueId x = sc.parallelize({'a','b','c','d','e'},3); out = x.zipWithUniqueId().collect(); % {{'a',0},{'b',1},{'c',4},{'d',2},{'e',5}}
parallelize | zip | zipWithIndex
parallelize
zip
zipWithIndex