Skip to content

Commit

Permalink
feat(primer): S25 P0 starter code (#795)
Browse files Browse the repository at this point in the history
* p0 starter code + tests

Signed-off-by: Yuchen Liang <[email protected]>

* ensure header

Signed-off-by: Yuchen Liang <[email protected]>

* fix header

Signed-off-by: Yuchen Liang <[email protected]>

* fix lint

Signed-off-by: Yuchen Liang <[email protected]>

* reserve before emplace loop

Signed-off-by: Yuchen Liang <[email protected]>

* amend check-public-ci-tests

Signed-off-by: Yuchen Liang <[email protected]>

* use simulated geometric process; update check-integrity test

Signed-off-by: Yuchen Liang <[email protected]>

---------

Signed-off-by: Yuchen Liang <[email protected]>
  • Loading branch information
yliang412 authored Jan 11, 2025
1 parent f97256b commit a5d44d7
Show file tree
Hide file tree
Showing 9 changed files with 800 additions and 127 deletions.
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,8 @@ add_custom_target(fix-clang-tidy-diff
# hardcode some files to check here for each project.
# ##########################################################
set(P0_FILES
"src/include/primer/hyperloglog.h"
"src/include/primer/hyperloglog_presto.h"
"src/primer/hyperloglog.cpp"
"src/primer/hyperloglog_presto.cpp"
"src/include/primer/skiplist.h"
"src/primer/skiplist.cpp"
)

add_custom_target(check-clang-tidy-p0
Expand Down
88 changes: 44 additions & 44 deletions src/execution/aggregation_executor.cpp
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
//===----------------------------------------------------------------------===//
//
// BusTub
//
// aggregation_executor.cpp
//
// Identification: src/execution/aggregation_executor.cpp
//
// Copyright (c) 2015-2025, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include <memory>
#include <vector>

#include "execution/executors/aggregation_executor.h"

namespace bustub {

/**
* Construct a new AggregationExecutor instance.
* @param exec_ctx The executor context
* @param plan The insert plan to be executed
* @param child_executor The child executor from which inserted tuples are pulled (may be `nullptr`)
*/
AggregationExecutor::AggregationExecutor(ExecutorContext *exec_ctx, const AggregationPlanNode *plan,
std::unique_ptr<AbstractExecutor> &&child_executor)
: AbstractExecutor(exec_ctx) {}

/** Initialize the aggregation */
void AggregationExecutor::Init() {}

/**
* Yield the next tuple from the insert.
* @param[out] tuple The next tuple produced by the aggregation
* @param[out] rid The next tuple RID produced by the aggregation
* @return `true` if a tuple was produced, `false` if there are no more tuples
*/
auto AggregationExecutor::Next(Tuple *tuple, RID *rid) -> bool { return false; }

/** Do not use or remove this function, otherwise you will get zero points. */
auto AggregationExecutor::GetChildExecutor() const -> const AbstractExecutor * { return child_executor_.get(); }

} // namespace bustub
//===----------------------------------------------------------------------===//
//
// BusTub
//
// aggregation_executor.cpp
//
// Identification: src/execution/aggregation_executor.cpp
//
// Copyright (c) 2015-2025, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include <memory>
#include <vector>

#include "execution/executors/aggregation_executor.h"

namespace bustub {

/**
* Construct a new AggregationExecutor instance.
* @param exec_ctx The executor context
* @param plan The insert plan to be executed
* @param child_executor The child executor from which inserted tuples are pulled (may be `nullptr`)
*/
AggregationExecutor::AggregationExecutor(ExecutorContext *exec_ctx, const AggregationPlanNode *plan,
std::unique_ptr<AbstractExecutor> &&child_executor)
: AbstractExecutor(exec_ctx) {}

/** Initialize the aggregation */
void AggregationExecutor::Init() {}

/**
* Yield the next tuple from the insert.
* @param[out] tuple The next tuple produced by the aggregation
* @param[out] rid The next tuple RID produced by the aggregation
* @return `true` if a tuple was produced, `false` if there are no more tuples
*/
auto AggregationExecutor::Next(Tuple *tuple, RID *rid) -> bool { return false; }

/** Do not use or remove this function, otherwise you will get zero points. */
auto AggregationExecutor::GetChildExecutor() const -> const AbstractExecutor * { return child_executor_.get(); }

} // namespace bustub
86 changes: 43 additions & 43 deletions src/execution/insert_executor.cpp
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
//===----------------------------------------------------------------------===//
//
// BusTub
//
// insert_executor.cpp
//
// Identification: src/execution/insert_executor.cpp
//
// Copyright (c) 2015-2025, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include <memory>

#include "execution/executors/insert_executor.h"

namespace bustub {

/**
* Construct a new InsertExecutor instance.
* @param exec_ctx The executor context
* @param plan The insert plan to be executed
* @param child_executor The child executor from which inserted tuples are pulled
*/
InsertExecutor::InsertExecutor(ExecutorContext *exec_ctx, const InsertPlanNode *plan,
std::unique_ptr<AbstractExecutor> &&child_executor)
: AbstractExecutor(exec_ctx) {}

/** Initialize the insert */
void InsertExecutor::Init() { throw NotImplementedException("InsertExecutor is not implemented"); }

/**
* Yield the number of rows inserted into the table.
* @param[out] tuple The integer tuple indicating the number of rows inserted into the table
* @param[out] rid The next tuple RID produced by the insert (ignore, not used)
* @return `true` if a tuple was produced, `false` if there are no more tuples
*
* NOTE: InsertExecutor::Next() does not use the `rid` out-parameter.
* NOTE: InsertExecutor::Next() returns true with number of inserted rows produced only once.
*/
auto InsertExecutor::Next([[maybe_unused]] Tuple *tuple, RID *rid) -> bool { return false; }

} // namespace bustub
//===----------------------------------------------------------------------===//
//
// BusTub
//
// insert_executor.cpp
//
// Identification: src/execution/insert_executor.cpp
//
// Copyright (c) 2015-2025, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include <memory>

#include "execution/executors/insert_executor.h"

namespace bustub {

/**
* Construct a new InsertExecutor instance.
* @param exec_ctx The executor context
* @param plan The insert plan to be executed
* @param child_executor The child executor from which inserted tuples are pulled
*/
InsertExecutor::InsertExecutor(ExecutorContext *exec_ctx, const InsertPlanNode *plan,
std::unique_ptr<AbstractExecutor> &&child_executor)
: AbstractExecutor(exec_ctx) {}

/** Initialize the insert */
void InsertExecutor::Init() { throw NotImplementedException("InsertExecutor is not implemented"); }

/**
* Yield the number of rows inserted into the table.
* @param[out] tuple The integer tuple indicating the number of rows inserted into the table
* @param[out] rid The next tuple RID produced by the insert (ignore, not used)
* @return `true` if a tuple was produced, `false` if there are no more tuples
*
* NOTE: InsertExecutor::Next() does not use the `rid` out-parameter.
* NOTE: InsertExecutor::Next() returns true with number of inserted rows produced only once.
*/
auto InsertExecutor::Next([[maybe_unused]] Tuple *tuple, RID *rid) -> bool { return false; }

} // namespace bustub
70 changes: 35 additions & 35 deletions src/execution/seq_scan_executor.cpp
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
//===----------------------------------------------------------------------===//
//
// BusTub
//
// seq_scan_executor.cpp
//
// Identification: src/execution/seq_scan_executor.cpp
//
// Copyright (c) 2015-2025, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include "execution/executors/seq_scan_executor.h"

namespace bustub {

/**
* Construct a new SeqScanExecutor instance.
* @param exec_ctx The executor context
* @param plan The sequential scan plan to be executed
*/
SeqScanExecutor::SeqScanExecutor(ExecutorContext *exec_ctx, const SeqScanPlanNode *plan) : AbstractExecutor(exec_ctx) {}

/** Initialize the sequential scan */
void SeqScanExecutor::Init() { throw NotImplementedException("SeqScanExecutor is not implemented"); }

/**
* Yield the next tuple from the sequential scan.
* @param[out] tuple The next tuple produced by the scan
* @param[out] rid The next tuple RID produced by the scan
* @return `true` if a tuple was produced, `false` if there are no more tuples
*/
auto SeqScanExecutor::Next(Tuple *tuple, RID *rid) -> bool { return false; }

} // namespace bustub
//===----------------------------------------------------------------------===//
//
// BusTub
//
// seq_scan_executor.cpp
//
// Identification: src/execution/seq_scan_executor.cpp
//
// Copyright (c) 2015-2025, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#include "execution/executors/seq_scan_executor.h"

namespace bustub {

/**
* Construct a new SeqScanExecutor instance.
* @param exec_ctx The executor context
* @param plan The sequential scan plan to be executed
*/
SeqScanExecutor::SeqScanExecutor(ExecutorContext *exec_ctx, const SeqScanPlanNode *plan) : AbstractExecutor(exec_ctx) {}

/** Initialize the sequential scan */
void SeqScanExecutor::Init() { throw NotImplementedException("SeqScanExecutor is not implemented"); }

/**
* Yield the next tuple from the sequential scan.
* @param[out] tuple The next tuple produced by the scan
* @param[out] rid The next tuple RID produced by the scan
* @return `true` if a tuple was produced, `false` if there are no more tuples
*/
auto SeqScanExecutor::Next(Tuple *tuple, RID *rid) -> bool { return false; }

} // namespace bustub
Loading

0 comments on commit a5d44d7

Please sign in to comment.