Main Content


Class: matlab.compiler.mlspark.RDD
Package: matlab.compiler.mlspark

Group data from RDDs sharing the same key


result = cogroup(obj1,obj2,numPartitions)


result = cogroup(obj1,obj2,numPartitions) groups the data from obj1 and obj2 that share the same key.

Input Arguments

expand all

The first input RDD, specified as a RDD object.

The second input RDD, specified as a RDD object.

Number of partitions to create, specified as a scalar value.

Data Types: double

Output Arguments

expand all

An RDD containing grouped data, returned as a RDD object.


expand all

%% Connect to Spark
sparkProp = containers.Map({'spark.executor.cores'}, {'1'});
conf = matlab.compiler.mlspark.SparkConf('AppName','myApp', ...
sc = matlab.compiler.mlspark.SparkContext(conf);

%% cogroup
x = sc.parallelize({ {'a',1}, {'b', 4} });
y = sc.parallelize({ {'a',2} });

Version History

Introduced in R2016b