| 36 | class BenchmarkHelper { |
| 37 | public: |
| 38 | BenchmarkHelper(Repetition::type repetition, int num_pages, int levels_per_page) { |
| 39 | NodePtr type = schema::Int32("b", repetition); |
| 40 | |
| 41 | if (repetition == Repetition::REQUIRED) { |
| 42 | descr_ = std::make_unique<ColumnDescriptor>(type, 0, 0); |
| 43 | } else if (repetition == Repetition::OPTIONAL) { |
| 44 | descr_ = std::make_unique<ColumnDescriptor>(type, 1, 0); |
| 45 | } else { |
| 46 | descr_ = std::make_unique<ColumnDescriptor>(type, 1, 1); |
| 47 | } |
| 48 | |
| 49 | // Vectors filled with random rep/defs and values to make pages. |
| 50 | std::vector<int32_t> values; |
| 51 | std::vector<int16_t> def_levels; |
| 52 | std::vector<int16_t> rep_levels; |
| 53 | std::vector<uint8_t> data_buffer; |
| 54 | MakePages<Int32Type>(descr_.get(), num_pages, levels_per_page, def_levels, rep_levels, |
| 55 | values, data_buffer, pages_, Encoding::PLAIN); |
| 56 | for (const auto& page : pages_) { |
| 57 | total_size_ += page->size(); |
| 58 | } |
| 59 | total_levels_ = static_cast<int64_t>(num_pages) * levels_per_page; |
| 60 | } |
| 61 | |
| 62 | Int32Reader* ResetColumnReader() { |
| 63 | std::unique_ptr<PageReader> pager; |