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

add extra leaderboard test #703

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
38 changes: 37 additions & 1 deletion src/execution/mock_scan_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ const char *mock_table_list[] = {"__mock_table_1", "__mock_table_2", "__mock_tab
// For leaderboard Q2
"__mock_t4_1m", "__mock_t5_1m", "__mock_t6_1m",
// For leaderboard Q3
"__mock_t7", "__mock_t8", "__mock_t9", nullptr};
"__mock_t7", "__mock_t8", "__mock_t9",
// For P3 leaderboard Q3
thelongmarch-azx marked this conversation as resolved.
Show resolved Hide resolved
"__mock_t10", "__mock_t11", nullptr};

static const int GRAPH_NODE_CNT = 10;

Expand Down Expand Up @@ -128,6 +130,14 @@ auto GetMockTableSchemaOf(const std::string &table) -> Schema {
return Schema{std::vector{Column{"x", TypeId::INTEGER}, Column{"y", TypeId::INTEGER}}};
}

if (table == "__mock_t10") {
return Schema{std::vector{Column{"x", TypeId::INTEGER}, Column{"y", TypeId::INTEGER}}};
}

if (table == "__mock_t11") {
return Schema{std::vector{Column{"x", TypeId::INTEGER}, Column{"y", TypeId::INTEGER}}};
}

throw bustub::Exception(fmt::format("mock table {} not found", table));
}

Expand Down Expand Up @@ -202,6 +212,14 @@ auto GetSizeOf(const MockScanPlanNode *plan) -> size_t {
return 10000000;
}

if (table == "__mock_t10") {
return 10000; // 10k
}

if (table == "__mock_t11") {
return 1000000; // 1M
}

return 0;
}

Expand Down Expand Up @@ -428,6 +446,24 @@ auto GetFunctionOf(const MockScanPlanNode *plan) -> std::function<Tuple(size_t)>
};
}

if (table == "__mock_t10") {
return [plan](size_t cursor) {
std::vector<Value> values{};
values.push_back(ValueFactory::GetIntegerValue(cursor));
values.push_back(ValueFactory::GetIntegerValue(cursor * 10));
return Tuple{values, &plan->OutputSchema()};
};
}

if (table == "__mock_t11") {
return [plan](size_t cursor) {
std::vector<Value> values{};
values.push_back(ValueFactory::GetIntegerValue(-1 * (cursor % 1000) - 1));
values.push_back(ValueFactory::GetIntegerValue(cursor * 10));
return Tuple{values, &plan->OutputSchema()};
};
}

// By default, return table of all 0.
return [plan](size_t cursor) {
std::vector<Value> values{};
Expand Down
3 changes: 3 additions & 0 deletions test/sql/p3.leaderboard-q4.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
query rowsort +timing:x20:.q1
select * from __mock_t10 a join __mock_t11 b on a.x = b.x;
----
Loading