|
| 1 | +#include "execution/execution_common.h" |
1 | 2 | #include "txn_common.h" // NOLINT
|
2 | 3 |
|
3 | 4 | namespace bustub {
|
@@ -137,7 +138,7 @@ TEST(TxnScanTest, DISABLED_ScanTest) { // NOLINT
|
137 | 138 | auto txn_store_2 = bustub->txn_manager_->Begin();
|
138 | 139 | ASSERT_EQ(txn_store_2->GetReadTs(), 1);
|
139 | 140 | prev_log_3 = txn_store_2->AppendUndoLog(
|
140 |
| - UndoLog{false, {true, true, true}, Tuple{{Int(4), DoubleNull(), BoolNull()}, schema.get()}, 1, {}}); |
| 141 | + UndoLog{false, {true, true, true}, Tuple{{Int(4), Double(4), Bool(true)}, schema.get()}, 1, {}}); |
141 | 142 | prev_log_6 =
|
142 | 143 | txn_store_2->AppendUndoLog(UndoLog{false, {true, false, false}, Tuple{{Int(7)}, modify_schema.get()}, 1, {}});
|
143 | 144 | bustub->txn_manager_->Commit(txn_store_2);
|
@@ -166,7 +167,7 @@ TEST(TxnScanTest, DISABLED_ScanTest) { // NOLINT
|
166 | 167 | auto txn_store_4 = bustub->txn_manager_->Begin();
|
167 | 168 | ASSERT_EQ(txn_store_4->GetReadTs(), 3);
|
168 | 169 | prev_log_4 = txn_store_4->AppendUndoLog(
|
169 |
| - UndoLog{false, {true, true, true}, Tuple{{Int(5), DoubleNull(), BoolNull()}, schema.get()}, 3, {}}); |
| 170 | + UndoLog{false, {true, true, true}, Tuple{{Int(5), Double(3), Bool(false)}, schema.get()}, 3, {}}); |
170 | 171 | bustub->txn_manager_->Commit(txn_store_4);
|
171 | 172 | ASSERT_EQ(txn_store_4->GetCommitTs(), 4);
|
172 | 173 | }
|
@@ -200,23 +201,33 @@ TEST(TxnScanTest, DISABLED_ScanTest) { // NOLINT
|
200 | 201 |
|
201 | 202 | TxnMgrDbg("before verify scan", bustub->txn_manager_.get(), table_info, table_info->table_.get());
|
202 | 203 |
|
203 |
| - auto query = "SELECT a FROM maintable"; |
| 204 | + auto query = "SELECT * FROM maintable"; |
204 | 205 | fmt::println(stderr, "A: Verify txn0");
|
205 |
| - WithTxn(txn0, QueryShowResult(*bustub, _var, _txn, query, IntResult{})); |
| 206 | + WithTxn(txn0, QueryShowResult(*bustub, _var, _txn, query, AnyResult{})); |
206 | 207 | fmt::println(stderr, "B: Verify txn1");
|
207 |
| - WithTxn(txn1, QueryShowResult(*bustub, _var, _txn, query, IntResult{{2}, {4}, {7}})); |
| 208 | + WithTxn(txn1, QueryShowResult(*bustub, _var, _txn, query, |
| 209 | + AnyResult{ |
| 210 | + {"2", "decimal_null", "boolean_null"}, |
| 211 | + {"4", "4.000000", "true"}, |
| 212 | + {"7", "decimal_null", "boolean_null"}, |
| 213 | + })); |
208 | 214 |
|
209 | 215 | // hidden tests... this is the only hidden test case among task 1, 2, 3. We recommend you to implement `TxnMgrDbg`
|
210 | 216 | // function, draw the version chain out, and think of what should be read by each txn.
|
211 | 217 |
|
| 218 | + // though we don't have null and double / bool types in task 3 and onwards, we will test them in this test case. |
| 219 | + // you should think about types other than integer, and think of the case where the user updates / inserts |
| 220 | + // a column of null. |
| 221 | + |
| 222 | + // auto query_int = "SELECT a FROM maintable"; |
212 | 223 | // fmt::println(stderr, "C: Verify txn2");
|
213 |
| - // WithTxn(txn2, QueryHideResult(*bustub, _var, _txn, query, IntResult{})); |
| 224 | + // WithTxn(txn2, QueryHideResult(*bustub, _var, _txn, query, IntResult{})); // <- you will need to fill in the answer |
214 | 225 | // fmt::println(stderr, "D: Verify txn3");
|
215 |
| - // WithTxn(txn3, QueryHideResult(*bustub, _var, _txn, query, IntResult{})); |
| 226 | + // WithTxn(txn3, QueryHideResult(*bustub, _var, _txn, query, IntResult{})); // <- you will need to fill in the answer |
216 | 227 | // fmt::println(stderr, "E: Verify txn4");
|
217 |
| - // WithTxn(txn4, QueryHideResult(*bustub, _var, _txn, query, IntResult{})); |
| 228 | + // WithTxn(txn4, QueryHideResult(*bustub, _var, _txn, query, IntResult{})); // <- you will need to fill in the answer |
218 | 229 | // fmt::println(stderr, "F: Verify txn5");
|
219 |
| - // WithTxn(txn5, QueryHideResult(*bustub, _var, _txn, query, IntResult{})); |
| 230 | + // WithTxn(txn5, QueryHideResult(*bustub, _var, _txn, query, IntResult{})); // <- you will need to fill in the answer |
220 | 231 | }
|
221 | 232 |
|
222 | 233 | // NOLINTEND(bugprone-unchecked-optional-access))
|
|
0 commit comments