Skip to content

Commit

Permalink
Update vendored DuckDB sources to ab398da
Browse files Browse the repository at this point in the history
  • Loading branch information
duckdblabs-bot committed Nov 13, 2024
1 parent ab398da commit d590207
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "4-dev1726"
#define DUCKDB_PATCH_VERSION "4-dev1771"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 1
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.1.4-dev1726"
#define DUCKDB_VERSION "v1.1.4-dev1771"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "a2dce8b1c9"
#define DUCKDB_SOURCE_ID "33f9165f5f"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
2 changes: 2 additions & 0 deletions src/duckdb/src/include/duckdb/main/relation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ class Relation : public enable_shared_from_this<Relation> {

//! Update a table, can only be used on a TableRelation
DUCKDB_API virtual void Update(const string &update, const string &condition = string());
DUCKDB_API virtual void Update(vector<string> column_names, vector<unique_ptr<ParsedExpression>> &&update,
unique_ptr<ParsedExpression> condition = nullptr);
//! Delete from a table, can only be used on a TableRelation
DUCKDB_API virtual void Delete(const string &condition = string());
//! Create a relation from calling a table in/out function on the input relation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class TableRelation : public Relation {
unique_ptr<TableRef> GetTableRef() override;

void Update(const string &update, const string &condition = string()) override;
void Update(vector<string> column_names, vector<unique_ptr<ParsedExpression>> &&update,
unique_ptr<ParsedExpression> condition = nullptr) override;
void Delete(const string &condition = string()) override;
};

Expand Down
8 changes: 8 additions & 0 deletions src/duckdb/src/main/relation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ void Relation::Update(const string &update, const string &condition) {
throw InvalidInputException("UPDATE can only be used on base tables!");
}

void Relation::Update(vector<string>, // NOLINT: unused variable / copied on every invocation ...
vector<unique_ptr<ParsedExpression>> &&update, // NOLINT: unused variable
unique_ptr<ParsedExpression> condition) { // NOLINT: unused variable
(void)std::move(update);
(void)std::move(condition);
throw InvalidInputException("UPDATE can only be used on base tables!");
}

void Relation::Delete(const string &condition) {
throw InvalidInputException("DELETE can only be used on base tables!");
}
Expand Down
11 changes: 11 additions & 0 deletions src/duckdb/src/main/relation/table_relation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ static unique_ptr<ParsedExpression> ParseCondition(ClientContext &context, const
}
}

void TableRelation::Update(vector<string> names, vector<unique_ptr<ParsedExpression>> &&update,
unique_ptr<ParsedExpression> condition) {
vector<string> update_columns = std::move(names);
vector<unique_ptr<ParsedExpression>> expressions = std::move(update);

auto update_relation =
make_shared_ptr<UpdateRelation>(context, std::move(condition), description->schema, description->table,
std::move(update_columns), std::move(expressions));
update_relation->Execute();
}

void TableRelation::Update(const string &update_list, const string &condition) {
vector<string> update_columns;
vector<unique_ptr<ParsedExpression>> expressions;
Expand Down
4 changes: 2 additions & 2 deletions src/duckdb/src/optimizer/unnest_rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ bool UnnestRewriter::RewriteCandidate(unique_ptr<LogicalOperator> &candidate) {
D_ASSERT(delim_join.type == LogicalOperatorType::LOGICAL_DELIM_JOIN);
GetDelimColumns(delim_join);

// LHS of the LOGICAL_DELIM_JOIN is a LOGICAL_WINDOW that contains a LOGICAL_PROJECTION
// LHS of the LOGICAL_DELIM_JOIN is a LOGICAL_WINDOW that contains a LOGICAL_PROJECTION/LOGICAL_CROSS_JOIN
// this lhs_proj later becomes the child of the UNNEST

idx_t delim_idx = delim_join.delim_flipped ? 1 : 0;
Expand Down Expand Up @@ -279,7 +279,7 @@ void UnnestRewriter::UpdateBoundUnnestBindings(UnnestRewriterPlanUpdater &update

if (delim_binding.table_index == unnest_binding.table_index) {
unnest_binding.table_index = overwritten_tbl_idx;
unnest_binding.column_index++;
unnest_binding.column_index = i;
updater.replace_bindings.emplace_back(unnest_binding, delim_binding);
unnest_cols.erase(unnest_it);
break;
Expand Down
10 changes: 10 additions & 0 deletions src/duckdb/src/planner/binder/query_node/bind_select_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,13 +616,23 @@ unique_ptr<BoundQueryNode> Binder::BindSelectNode(SelectNode &statement, unique_
}

// push the GROUP BY ALL expressions into the group set

for (auto &group_by_all_index : group_by_all_indexes) {
auto &expr = result->select_list[group_by_all_index];
auto group_ref = make_uniq<BoundColumnRefExpression>(
expr->return_type, ColumnBinding(result->group_index, result->groups.group_expressions.size()));
result->groups.group_expressions.push_back(std::move(expr));
expr = std::move(group_ref);
}
set<idx_t> group_by_all_indexes_set;
if (!group_by_all_indexes.empty()) {
idx_t num_set_indexes = result->groups.group_expressions.size();
for (idx_t i = 0; i < num_set_indexes; i++) {
group_by_all_indexes_set.insert(i);
}
D_ASSERT(result->groups.grouping_sets.empty());
result->groups.grouping_sets.push_back(group_by_all_indexes_set);
}
result->column_count = new_names.size();
result->names = std::move(new_names);
result->need_prune = result->select_list.size() > result->column_count;
Expand Down
5 changes: 2 additions & 3 deletions src/duckdb/src/transaction/duck_transaction_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ void DuckTransactionManager::Checkpoint(ClientContext &context, bool force) {
lock = checkpoint_lock.TryGetExclusiveLock();
if (!lock) {
// we could not manage to get the lock - cancel
throw TransactionException(
"Cannot CHECKPOINT: there are other write transactions active. Use FORCE CHECKPOINT to abort "
"the other transactions and force a checkpoint");
throw TransactionException("Cannot CHECKPOINT: there are other write transactions active. Try using FORCE "
"CHECKPOINT to wait until all active transactions are finished");
}

} else {
Expand Down

0 comments on commit d590207

Please sign in to comment.