Skip to content

Commit

Permalink
add extra leaderboard test (#703)
Browse files Browse the repository at this point in the history
* add extra leaderboard test

* add extra leaderboard test

* update comment

---------

Co-authored-by: Zixi An <[email protected]>
Co-authored-by: Zixi An <[email protected]>
  • Loading branch information
3 people committed Mar 13, 2024
1 parent bc3b742 commit dba9b72
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
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 Q4
"__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;
----

0 comments on commit dba9b72

Please sign in to comment.