| 1768 | } |
| 1769 | |
| 1770 | Status GenerateRowCounts(size_t thread_index) { |
| 1771 | ThreadLocalData& tld = thread_local_data_[thread_index]; |
| 1772 | std::uniform_int_distribution<int> length_dist(1, 7); |
| 1773 | tld.lineitem_to_generate = 0; |
| 1774 | tld.items_per_order.clear(); |
| 1775 | for (int64_t i = 0; i < tld.orders_to_generate; i++) { |
| 1776 | int length = length_dist(tld.rng); |
| 1777 | tld.items_per_order.push_back(length); |
| 1778 | tld.lineitem_to_generate += length; |
| 1779 | } |
| 1780 | int64_t num_batches = |
| 1781 | (tld.first_batch_offset + tld.lineitem_to_generate + batch_size_ - 1) / |
| 1782 | batch_size_; |
| 1783 | tld.lineitem.resize(num_batches); |
| 1784 | for (std::vector<Datum>& batch : tld.lineitem) { |
| 1785 | batch.resize(LINEITEM::kNumCols); |
| 1786 | std::fill(batch.begin(), batch.end(), Datum()); |
| 1787 | } |
| 1788 | return Status::OK(); |
| 1789 | } |
| 1790 | |
| 1791 | Status AllocateLineItemBufferIfNeeded(size_t thread_index, size_t ibatch, int column, |
| 1792 | size_t& out_batch_offset) { |