Skip to content

Commit dba9b72

Browse files
thelongmarch-azxZixi AnZixi An
authored
add extra leaderboard test (#703)
* add extra leaderboard test * add extra leaderboard test * update comment --------- Co-authored-by: Zixi An <[email protected]> Co-authored-by: Zixi An <[email protected]>
1 parent bc3b742 commit dba9b72

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

src/execution/mock_scan_executor.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ const char *mock_table_list[] = {"__mock_table_1", "__mock_table_2", "__mock_tab
5353
// For leaderboard Q2
5454
"__mock_t4_1m", "__mock_t5_1m", "__mock_t6_1m",
5555
// For leaderboard Q3
56-
"__mock_t7", "__mock_t8", "__mock_t9", nullptr};
56+
"__mock_t7", "__mock_t8", "__mock_t9",
57+
// For P3 leaderboard Q4
58+
"__mock_t10", "__mock_t11", nullptr};
5759

5860
static const int GRAPH_NODE_CNT = 10;
5961

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

133+
if (table == "__mock_t10") {
134+
return Schema{std::vector{Column{"x", TypeId::INTEGER}, Column{"y", TypeId::INTEGER}}};
135+
}
136+
137+
if (table == "__mock_t11") {
138+
return Schema{std::vector{Column{"x", TypeId::INTEGER}, Column{"y", TypeId::INTEGER}}};
139+
}
140+
131141
throw bustub::Exception(fmt::format("mock table {} not found", table));
132142
}
133143

@@ -202,6 +212,14 @@ auto GetSizeOf(const MockScanPlanNode *plan) -> size_t {
202212
return 10000000;
203213
}
204214

215+
if (table == "__mock_t10") {
216+
return 10000; // 10k
217+
}
218+
219+
if (table == "__mock_t11") {
220+
return 1000000; // 1M
221+
}
222+
205223
return 0;
206224
}
207225

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

449+
if (table == "__mock_t10") {
450+
return [plan](size_t cursor) {
451+
std::vector<Value> values{};
452+
values.push_back(ValueFactory::GetIntegerValue(cursor));
453+
values.push_back(ValueFactory::GetIntegerValue(cursor * 10));
454+
return Tuple{values, &plan->OutputSchema()};
455+
};
456+
}
457+
458+
if (table == "__mock_t11") {
459+
return [plan](size_t cursor) {
460+
std::vector<Value> values{};
461+
values.push_back(ValueFactory::GetIntegerValue(-1 * (cursor % 1000) - 1));
462+
values.push_back(ValueFactory::GetIntegerValue(cursor * 10));
463+
return Tuple{values, &plan->OutputSchema()};
464+
};
465+
}
466+
431467
// By default, return table of all 0.
432468
return [plan](size_t cursor) {
433469
std::vector<Value> values{};

test/sql/p3.leaderboard-q4.slt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
query rowsort +timing:x20:.q1
2+
select * from __mock_t10 a join __mock_t11 b on a.x = b.x;
3+
----

0 commit comments

Comments
 (0)