vector<T> CollectTask<T>::run() { IteratorSeq<T> *iter = RDDTask< T, vector<T> >::rdd->iteratorSeq(RDDTask< T, vector<T> >::partition); // if(iter.type == 0) // { // vector<T> *tmp = new vector<T>; // T start = iter.getStart(); // T end = iter.getEnd(); // T step = iter.getStep(); // T i = start; // for(; i<end; i+=step) // tmp->push_back(i); // // if(i == end && iter.isInclusive() == 1) // tmp->push_back(end); // // return *tmp; // } // // type = 1 return iter->getVector(); }
bool IteratorSeq<T>::operator==(const IteratorSeq<T> &s) const { return (this->getType() == s.getType() // the same type && this->size() == s.size() // the same number of elements && this->getVector() == s.getVector()); // and the same data set }
/* * to run the reduce function on the data in the corresponding partition */ template <class T> vector<T> ReduceTask<T>::run() { IteratorSeq<T> *iter = RDDTask< T, vector<T> >::rdd->iteratorSeq(RDDTask< T, vector<T> >::partition); return iter->reduceLeft(g); }