An iterator over intermediate values for use with mapreduce
mapreduce function automatically creates a
ValueIterator object during execution and uses it to store the
values associated with each unique intermediate key added by the map function. Although
you never need to explicitly create a
ValueIterator object to use
mapreduce, you do need to interact with this object in the
reduce function. Use the
object functions to retrieve the values associated with each unique key in the
mapreduce function automatically creates
ValueIterator objects during execution.
Key — Intermediate key
numeric scalar | character vector
This property is read-only.
Intermediate key, specified as a numeric scalar or character vector.
Key is one of the unique keys added by a map
function. All the values in the
ValueIterator object are
associated with this key.
Get Values from ValueIterator in Reduce Function
functions in a
while loop within the reduce function to
iteratively get values from the
function MeanDistReduceFun(sumLenKey, sumLenIter, outKVStore) sumLen = [0, 0]; while hasnext(sumLenIter) sumLen = sumLen + getnext(sumLenIter); end add(outKVStore, 'Mean', sumLen(1)/sumLen(2)); end
to confirm availability of a value.
mapreduce returns an
error if you call
getnext with no remaining values in the
Introduced in R2014b