Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p3: check commit success and explain full q1 #657

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/common/bustub_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ auto BustubInstance::ExecuteSql(const std::string &sql, ResultWriter &writer,
auto *txn = txn_manager_->Begin();
try {
auto result = ExecuteSqlTxn(sql, writer, txn, std::move(check_options));
txn_manager_->Commit(txn);
if (!txn_manager_->Commit(txn)) {
throw Exception("failed to commit txn");
}
return result;
} catch (bustub::Exception &ex) {
txn_manager_->Abort(txn);
Expand Down
12 changes: 7 additions & 5 deletions test/sql/p3.leaderboard-q1-window.slt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
statement ok
explain (o) select x, y from (
select x, y, rank() over (partition by x order by y) as rank
from __mock_t9
) where rank <= 3;
explain (o) select * from (
select x, y from (
select x, y, rank() over (partition by x order by y) as rank
from __mock_t9
) where rank <= 3
) order by y limit 10;

query nosort +timing:x10:.q1
select * from (
Expand All @@ -21,4 +23,4 @@ select * from (
998 5005001
998 5005001
998 5005002
998 5005002
998 5005002
Loading