Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce amount of CartesianProductJoinLazyTest variants #1648

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions test/engine/CartesianProductJoinTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,19 @@ TEST(CartesianProductJoin, variableColumnMap) {
::testing::UnorderedElementsAreArray(expectedVariables));
}

// First parameter indicates "seed" for splitting the last input table.
// First parameter indicates if the last input table should be split into
// pseudo-random splits.
// Second parameter indicates the offset for the LIMIT clause.
// Third parameter indicates the limit for the LIMIT clause.
class CartesianProductJoinLazyTest
: public testing::TestWithParam<
std::tuple<uint64_t, size_t, std::optional<size_t>>> {
std::tuple<bool, size_t, std::optional<size_t>>> {
// Randomly split `idTable` into equivalent subsets of itself at pseudo-random
// positions.
static std::vector<IdTable> splitIntoRandomSubtables(const IdTable& idTable) {
AD_CORRECTNESS_CHECK(std::get<0>(GetParam()));
// Ensure results are reproducible.
std::mt19937_64 generator{std::get<0>(GetParam())};
std::mt19937_64 generator{(getLimit() << 32) + getOffset()};
// The average size of splits.
size_t averageSplitSize =
std::uniform_int_distribution<size_t>{0, idTable.size()}(generator);
Expand Down Expand Up @@ -603,22 +605,21 @@ TEST(CartesianProductJoinLazy, lazyTableTurnsOutEmptyWithEmptyGenerator) {

// _____________________________________________________________________________

using ::testing::Range;
using ::testing::Bool;
using ::testing::Values;
INSTANTIATE_TEST_SUITE_P(
CartesianProdctJoinTestSuite, CartesianProductJoinLazyTest,
::testing::Combine(
Range<uint64_t>(0, 5),
Values(0, 1, 25, CHUNK_SIZE, CHUNK_SIZE + 1, CHUNK_SIZE * 2),
Bool(), Values(0, 1, 25, CHUNK_SIZE, CHUNK_SIZE + 1, CHUNK_SIZE * 2),
Values(O{0}, O{1}, O{25}, O{CHUNK_SIZE}, O{CHUNK_SIZE * 2},
O{CHUNK_SIZE * 10}, std::nullopt)),
[](const testing::TestParamInfo<
std::tuple<uint64_t, size_t, std::optional<size_t>>>& info) {
std::tuple<bool, size_t, std::optional<size_t>>>& info) {
std::ostringstream stream;
if (std::get<0>(info.param) == 0) {
stream << "FullyMaterialized";
if (std::get<0>(info.param)) {
stream << "WithSplitTables";
} else {
stream << "WithSplitSeed_" << std::get<0>(info.param);
stream << "FullyMaterialized";
}
stream << "_Offset_" << std::get<1>(info.param);
stream << "_Limit_";
Expand Down
Loading