Main Content

union

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

Return the set union of one RDD with another

Syntax

result = union(obj1,obj2)

Description

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.

Examples

expand all

%% 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);

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

Version History

Introduced in R2016b