This is an example use case of collecting all the elements into a vector data structure in the end.
#include <iostream>
#include "collect.h"
#include "generator_rdd.h"
#include "plain_rdd.h"
int main() {
using namespace cpark;
auto transformed_iota_view =
std::views::iota(1, 100 + 1) | std::views::transform([](auto x) { return x * x; });
concepts::Rdd
auto plain_rdd =
PlainRdd(transformed_iota_view, &default_context);
std::cout << "The plain Rdd has " << plain_rdd.size() << " splits." << std::endl;
concepts::Split auto first_plain_split = plain_rdd.front();
concepts::Split auto second_plain_split = plain_rdd[2];
concepts::Split auto last_plain_split = plain_rdd.back();
auto iterator_to_first_plain_split = plain_rdd.begin();
auto iterator_past_last_plain_split = plain_rdd.end();
auto iterator_to_first_element = first_plain_split.begin();
int first_element = first_plain_split.front();
std::cout << "The first split of plain rdd contains the following elements: ";
for (int x : first_plain_split) {
std::cout << x << ", ";
}
std::cout << std::endl;
std::cout << "The last split of plain rdd contains the following elements: ";
for (int x : plain_rdd.back()) {
std::cout << x << ", ";
}
std::cout << std::endl;
std::cout << "Collect rdd (basic): " << std::endl;
auto collect_rdd_1 = plain_rdd |
Collect( );
std::cout <<"element in collection: " << std::endl;
for(auto c : collect_rdd_1) {
std::cout << c << std::endl;
}
}
Config & setDebugName(std::string name) noexcept
Definition cpark.h:76
Definition plain_rdd.h:21