13 #include "eckit/io/PartFileHandle.h"
14 #include "eckit/io/Offset.h"
15 #include "eckit/io/Length.h"
23 using namespace eckit;
27 Partitions Partitioner::createPartitions(
const std::vector<eckit::PathName>& files,
size_t numberOfPartitions)
29 std::vector<PathName> indices;
30 for (
size_t i (0);
i < files.size(); ++
i)
31 indices.push_back(files[
i] +
".idx");
33 return createPartitions(files, indices, numberOfPartitions);
36 Partitions Partitioner::createPartitions(
const std::vector<eckit::PathName>& files,
const std::vector<eckit::PathName>& indices,
size_t numberOfPartitions)
38 if (numberOfPartitions > 2) --numberOfPartitions;
41 ullong totalRowsNumber (countRows (files, indices));
42 ullong rowsPerPartition ((totalRowsNumber / numberOfPartitions));
44 Log::info() <<
"*** createPartitions: numberOfPartitions: " << numberOfPartitions <<
", totalRowsNumber: " << totalRowsNumber <<
", rowsPerPartition: " << rowsPerPartition << std::endl;
45 for (
size_t i(0);
i < indices.size(); ++
i)
47 odc::Select in(
"select block_begin, block_length, seqno, n_rows;", indices[
i]);
50 const ullong blockStart ((*it)[0]),
51 blockLength ((*it)[1]),
55 parts.
addReport(files[
i], blockStart, blockLength, seqno, nRows, rowsPerPartition);
78 ullong Partitioner::countRows(
const std::vector<eckit::PathName>& files,
const std::vector<eckit::PathName>& indices)
81 for (
size_t i(0);
i < files.size(); ++
i)
82 n += RowsCounter::fastRowCount(files[
i]);
void addReport(const eckit::PathName &fileName, ullong blockStart, ullong blockLength, ullong seqno, ullong nRows, ullong rowsPerPartition)
unsigned long long ullong