Skip to content

Commit

Permalink
chore: Update vendored sources to duckdb/duckdb@2c21eb1 (#508)
Browse files Browse the repository at this point in the history
[Appender] Support appending to table with generated columns (duckdb/duckdb#14346)
JSON reader - never generate maps if map_inference_threshold is -1 (duckdb/duckdb#14348)

Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and krlmlr authored Oct 17, 2024
1 parent ab3e7c8 commit 6773e5c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 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 "2-dev204"
#define DUCKDB_PATCH_VERSION "2-dev208"
#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.2-dev204"
#define DUCKDB_VERSION "v1.1.2-dev208"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "cc067e6b7d"
#define DUCKDB_SOURCE_ID "2c21eb1c2e"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
14 changes: 14 additions & 0 deletions src/duckdb/src/include/duckdb/main/table_description.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,26 @@
namespace duckdb {

struct TableDescription {
public:
//! The schema of the table
string schema;
//! The table name of the table
string table;
//! The columns of the table
vector<ColumnDefinition> columns;

public:
idx_t PhysicalColumnCount() const {
idx_t count = 0;
for (auto &column : columns) {
if (column.Generated()) {
continue;
}
count++;
}
D_ASSERT(count != 0);
return count;
}
};

} // namespace duckdb
3 changes: 3 additions & 0 deletions src/duckdb/src/main/appender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Appender::Appender(Connection &con, const string &schema_name, const string &tab
}
vector<optional_ptr<const ParsedExpression>> defaults;
for (auto &column : description->columns) {
if (column.Generated()) {
continue;
}
types.push_back(column.Type());
defaults.push_back(column.HasDefaultValue() ? &column.DefaultValue() : nullptr);
}
Expand Down
10 changes: 8 additions & 2 deletions src/duckdb/src/main/client_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,13 +1132,19 @@ void ClientContext::Append(TableDescription &description, ColumnDataCollection &
auto &table_entry =
Catalog::GetEntry<TableCatalogEntry>(*this, INVALID_CATALOG, description.schema, description.table);
// verify that the table columns and types match up
if (description.columns.size() != table_entry.GetColumns().PhysicalColumnCount()) {
if (description.PhysicalColumnCount() != table_entry.GetColumns().PhysicalColumnCount()) {
throw InvalidInputException("Failed to append: table entry has different number of columns!");
}
idx_t table_entry_col_idx = 0;
for (idx_t i = 0; i < description.columns.size(); i++) {
if (description.columns[i].Type() != table_entry.GetColumns().GetColumn(PhysicalIndex(i)).Type()) {
auto &column = description.columns[i];
if (column.Generated()) {
continue;
}
if (column.Type() != table_entry.GetColumns().GetColumn(PhysicalIndex(table_entry_col_idx)).Type()) {
throw InvalidInputException("Failed to append: table entry has different number of columns!");
}
table_entry_col_idx++;
}
auto binder = Binder::CreateBinder(*this);
auto bound_constraints = binder->BindConstraints(table_entry);
Expand Down

0 comments on commit 6773e5c

Please sign in to comment.