Skip to content

Commit

Permalink
feat(f24-p3): add new mock tables (#761)
Browse files Browse the repository at this point in the history
* feat: add new mock tables

* remove unused comments
  • Loading branch information
xx01cyx authored Oct 18, 2024
1 parent d5f7943 commit 32d7085
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion src/execution/mock_scan_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ static const char *ta_list_2023_fall[] = {"skyzh", "yliang412", "ferna
static const char *ta_list_2024[] = {"AlSchlo", "walkingcabbages", "averyqi115", "lanlou1554", "sweetsuro",
"ChaosZhai", "SDTheSlayer", "xx01cyx", "yliang412", "thelongmarch-azx"};

static const char *ta_list_2024_fall[] = {"17zhangw", "connortsui20", "J-HowHuang", "lanlou1554",
"prashanthduvvada", "unw9527", "xx01cyx", "yashkothari42"};

static const char *ta_oh_2022[] = {"Tuesday", "Wednesday", "Monday", "Wednesday", "Thursday", "Friday",
"Wednesday", "Randomly", "Tuesday", "Monday", "Tuesday"};

Expand All @@ -48,11 +51,15 @@ static const char *ta_oh_2023_fall[] = {"Randomly", "Tuesday", "Wednesday", "T
static const char *ta_oh_2024[] = {"Friday", "Thursday", "Friday", "Wednesday", "Thursday",
"Yesterday", "Monday", "Tuesday", "Tuesday", "Monday"};

static const char *ta_oh_2024_fall[] = {"Wednesday", "Thursday", "Tuesday", "Monday",
"Friday", "Thursday", "Tuesday", "Friday"};

static const char *course_on_date[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

const char *mock_table_list[] = {"__mock_table_1", "__mock_table_2", "__mock_table_3", "__mock_table_tas_2022",
"__mock_table_tas_2023", "__mock_table_tas_2023_fall", "__mock_table_tas_2024",
"__mock_agg_input_small", "__mock_agg_input_big", "__mock_table_schedule_2022",
"__mock_table_tas_2024_fall", "__mock_agg_input_small", "__mock_agg_input_big",
"__mock_external_merge_sort_input", "__mock_table_schedule_2022",
"__mock_table_schedule", "__mock_table_123", "__mock_graph",
// For leaderboard Q1
"__mock_t1",
Expand Down Expand Up @@ -94,6 +101,10 @@ auto GetMockTableSchemaOf(const std::string &table) -> Schema {
return Schema{std::vector{Column{"github_id", TypeId::VARCHAR, 128}, Column{"office_hour", TypeId::VARCHAR, 128}}};
}

if (table == "__mock_table_tas_2024_fall") {
return Schema{std::vector{Column{"github_id", TypeId::VARCHAR, 128}, Column{"office_hour", TypeId::VARCHAR, 128}}};
}

if (table == "__mock_table_schedule_2022") {
return Schema{std::vector{Column{"day_of_week", TypeId::VARCHAR, 128}, Column{"has_lecture", TypeId::INTEGER}}};
}
Expand All @@ -108,6 +119,11 @@ auto GetMockTableSchemaOf(const std::string &table) -> Schema {
Column{"v5", TypeId::INTEGER}, Column{"v6", TypeId::VARCHAR, 128}}};
}

if (table == "__mock_external_merge_sort_input") {
return Schema{
std::vector{Column{"v1", TypeId::INTEGER}, Column{"v2", TypeId::INTEGER}, Column{"v3", TypeId::INTEGER}}};
}

if (table == "__mock_graph") {
return Schema{std::vector{Column{"src", TypeId::INTEGER}, Column{"dst", TypeId::INTEGER},
Column{"src_label", TypeId::VARCHAR, 8}, Column{"dst_label", TypeId::VARCHAR, 8},
Expand Down Expand Up @@ -182,6 +198,10 @@ auto GetSizeOf(const MockScanPlanNode *plan) -> size_t {
return sizeof(ta_list_2024) / sizeof(ta_list_2024[0]);
}

if (table == "__mock_table_tas_2024_fall") {
return sizeof(ta_list_2024_fall) / sizeof(ta_list_2024_fall[0]);
}

if (table == "__mock_table_schedule_2022") {
return sizeof(course_on_date) / sizeof(course_on_date[0]);
}
Expand All @@ -198,6 +218,10 @@ auto GetSizeOf(const MockScanPlanNode *plan) -> size_t {
return 10000;
}

if (table == "__mock_external_merge_sort_input") {
return 100000;
}

if (table == "__mock_graph") {
return GRAPH_NODE_CNT * GRAPH_NODE_CNT;
}
Expand Down Expand Up @@ -329,6 +353,15 @@ auto GetFunctionOf(const MockScanPlanNode *plan) -> std::function<Tuple(size_t)>
};
}

if (table == "__mock_table_tas_2024_fall") {
return [plan](size_t cursor) {
std::vector<Value> values{};
values.push_back(ValueFactory::GetVarcharValue(ta_list_2024_fall[cursor]));
values.push_back(ValueFactory::GetVarcharValue(ta_oh_2024_fall[cursor]));
return Tuple{values, &plan->OutputSchema()};
};
}

if (table == "__mock_table_schedule_2022") {
return [plan](size_t cursor) {
std::vector<Value> values{};
Expand Down Expand Up @@ -375,6 +408,16 @@ auto GetFunctionOf(const MockScanPlanNode *plan) -> std::function<Tuple(size_t)>
};
}

if (table == "__mock_external_merge_sort_input") {
return [plan](size_t cursor) {
std::vector<Value> values{};
values.push_back(ValueFactory::GetIntegerValue(cursor));
values.push_back(ValueFactory::GetIntegerValue((cursor + 1777) % 15000));
values.push_back(ValueFactory::GetIntegerValue((cursor + 3) % 111));
return Tuple{values, &plan->OutputSchema()};
};
}

if (table == "__mock_table_123") {
return [plan](size_t cursor) {
std::vector<Value> values{};
Expand Down

0 comments on commit 32d7085

Please sign in to comment.