Main Content


Class: matlab.compiler.mlspark.RDD
Namespace: matlab.compiler.mlspark

Coalesce all elements within each partition of an RDD


result = glom(obj)


result = glom(obj) returns an RDD result created by coalescing all elements within each partition of obj.

Input Arguments

expand all

An input RDD, specified as a RDD object.

Output Arguments

expand all

A pipelined RDD containing coalesced elements within each partition of the input RDD, 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);

%% glom
inputRDD = sc.parallelize({'A','B','C','D','E','C','B'}); 
mapRDD ={x,1})); 
redRDD = mapRDD.reduceByKey(@(x,y)(x+y),3); 
out = redRDD.glom().collect() % { {{'C',2}}, {{'A',1},{'D',1}}, {{'B',2},{'E',1}} } 
% 3 cell arrays as 3 partitions were created by reduceByKey

Version History

Introduced in R2016b