Main Content


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

Return the set intersection of one RDD with another


result = intersection(obj1,obj2)


result = intersection(obj1,obj2) returns elements that are the set intersection 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 intersection 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);

%% intersection
x = sc.parallelize({'A','B','C'});
y = sc.parallelize({'B','D'});
z = sc.parallelize({'E','F'});
out1 = x.intersection(y).collect(); % {'B'}

Version History

Introduced in R2016b