Main Content

keys

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

Return an RDD with the keys of each tuple

Syntax

result = keys(obj)

Description

result = keys(obj) returns an RDD result with the keys of each tuple in obj.

Input Arguments

expand all

An input RDD, specified as a RDD object.

Output Arguments

expand all

A pipelined RDD containing the keys of each tuple in the input RDD, 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);

%% keys
m = sc.parallelize({ {'AA', {5,15} }, {'BB', 200}});
out = m.keys().collect();

See Also

|

Introduced in R2016b