struct Table
{
std::vector<std::string> get_column_names() const;
};
Сделать псевдонимы
using Raw = ... ;
using Table = ... ;
Необходимо сделать функцию загрузки .csv
файлов в класс Table
.
Table read_csv(std::string const& filename, char sep = ';', bool header = false);
Пример использования MapReduce:
auto table = read_csv("bigfile.csv");
auto mapper_op = [](Raw & raw, OutIt out) {
for (auto& col in row)
{
if (col.find("iu8") != std::string::npos)
{
std::map<std::string, std::string> data = {
{"name", col},
{"university", "bmstu"}
};
*out = Raw(data);
++out;
}
}
};
auto reducer_op = [](std::vector<Raw> & raws, OutIt out) {
// ...
};
Table new_table = run_map(mapper_op, table);
run_sort(newTable, {"name"});
Table result_table = run_reduce(reducer_op, {"name"}, new_table);