Main Content


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

Return the set union of one RDD with another


result = union(obj1,obj2)


result = union(obj1,obj2) returns elements that are the set union of obj1 and obj2.

Input Arguments

expand all

An input RDD, specified as a RDD object.

An input RDD, specified as a RDD object.

Output Arguments

expand all

A pipelined RDD containing the set union of the two input RDDs, 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);

%% union
inRDD = sc.parallelize({'A','B'});
newRDD = inRDD.union(inRDD);  %{'A','B', 'A','B'}
viewRes = newRDD.collect()

Version History

Introduced in R2016b