Class: matlab.compiler.mlspark.RDD Package: matlab.compiler.mlspark
Count number of elements in an RDD
result = count(obj)
result = count(obj) counts the number of elements in obj.
result
obj
expand all
RDD
An input RDD to count, specified as a RDD object.
The number of elements in an input RDD, returned as a scalar.
% 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); % count countVal = sc.parallelize({1, 2, 3, 4, 5}).count(); disp(countVal);
matlab.compiler.mlspark.SparkContext.parallelize