| 129 | } |
| 130 | |
| 131 | void testCycle( |
| 132 | BaseHashTable::HashMode mode, |
| 133 | int32_t size, |
| 134 | int32_t numWays, |
| 135 | TypePtr buildType, |
| 136 | int32_t numKeys) { |
| 137 | std::vector<TypePtr> dependentTypes; |
| 138 | int32_t sequence = 0; |
| 139 | isInTable_.resize( |
| 140 | bits::nwords(numWays * size), |
| 141 | static_cast<const std::vector< |
| 142 | unsigned long, |
| 143 | std::allocator<unsigned long>>::value_type>(-1)); |
| 144 | if (insertPct_ != 100) { |
| 145 | // If we probe with all keys but only mean to insert part, we deselect. |
| 146 | folly::Random::DefaultGenerator rng; |
| 147 | rng.seed(1); |
| 148 | for (auto i = 0; i < size * numWays; ++i) { |
| 149 | if (folly::Random::rand32(rng) % 100 > insertPct_) { |
| 150 | bits::clearBit(isInTable_.data(), i); |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | int32_t startOffset = 0; |
| 155 | std::vector<std::unique_ptr<BaseHashTable>> otherTables; |
| 156 | uint64_t numRows{0}; |
| 157 | for (auto way = 0; way < numWays; ++way) { |
| 158 | std::vector<RowVectorPtr> batches; |
| 159 | std::vector<std::unique_ptr<VectorHasher>> keyHashers; |
| 160 | for (auto channel = 0; channel < numKeys; ++channel) { |
| 161 | keyHashers.emplace_back(std::make_unique<VectorHasher>( |
| 162 | buildType->childAt(channel), channel)); |
| 163 | } |
| 164 | auto table = HashTable<true>::createForJoin( |
| 165 | std::move(keyHashers), |
| 166 | dependentTypes, |
| 167 | true, |
| 168 | false, |
| 169 | BaseHashTable::HashMode::kArray, |
| 170 | 1'000, |
| 171 | pool(), |
| 172 | GetParam().jitRowEqVectors); |
| 173 | |
| 174 | makeRows(size, 1, sequence, buildType, batches); |
| 175 | copyVectorsToTable(batches, startOffset, table.get()); |
| 176 | sequence += size; |
| 177 | if (topTable_ == nullptr) { |
| 178 | topTable_ = std::move(table); |
| 179 | numRows += topTable_->rows()->numRows(); |
| 180 | } else { |
| 181 | numRows += table->rows()->numRows(); |
| 182 | otherTables.push_back(std::move(table)); |
| 183 | } |
| 184 | batches_.insert(batches_.end(), batches.begin(), batches.end()); |
| 185 | startOffset += size; |
| 186 | } |
| 187 | |
| 188 | const uint64_t estimatedTableSize = |
nothing calls this directly
no test coverage detected