Skip to content

Commit d227658

Browse files
duckdblabs-botgithub-actions[bot]
authored andcommitted
Update vendored DuckDB sources to 19dd651b26
1 parent 631c75d commit d227658

25 files changed

Lines changed: 132 additions & 86 deletions

src/duckdb/src/catalog/catalog.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,4 +1235,9 @@ void Catalog::FinalizeLoad(optional_ptr<ClientContext> context) {
12351235
void Catalog::OnDetach(ClientContext &context) {
12361236
}
12371237

1238+
bool Catalog::HasConflictingAttachOptions(const string &path, const AttachOptions &options) {
1239+
auto const db_type = options.db_type.empty() ? "duckdb" : options.db_type;
1240+
return GetDBPath() != path || GetCatalogType() != db_type;
1241+
}
1242+
12381243
} // namespace duckdb

src/duckdb/src/common/sorting/hashed_sort.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,9 @@ HashedSortLocalSinkState::HashedSortLocalSinkState(ExecutionContext &context, co
341341
}
342342
// OVER(...)
343343
payload_chunk.Initialize(allocator, payload_types);
344+
} else {
345+
unsorted = make_uniq<ColumnDataCollection>(context.client, hashed_sort.payload_types);
346+
unsorted->InitializeAppend(unsorted_append);
344347
}
345348
}
346349

@@ -369,10 +372,6 @@ SinkResultType HashedSort::Sink(ExecutionContext &context, DataChunk &input_chun
369372

370373
// OVER()
371374
if (gstate.hashed_sort.sort_col_count == 0) {
372-
if (!lstate.unsorted) {
373-
lstate.unsorted = make_uniq<ColumnDataCollection>(context.client, payload_types);
374-
lstate.unsorted->InitializeAppend(lstate.unsorted_append);
375-
}
376375
lstate.unsorted->Append(lstate.unsorted_append, input_chunk);
377376
return SinkResultType::NEED_MORE_INPUT;
378377
}

src/duckdb/src/execution/operator/schema/physical_attach.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ SourceResultType PhysicalAttach::GetData(ExecutionContext &context, DataChunk &c
5151
existing_db->GetCatalog().SetDefaultTable(options.default_table.schema, options.default_table.name);
5252
}
5353
if (info->on_conflict == OnCreateConflict::REPLACE_ON_CONFLICT) {
54-
// same path, name and type, DB does not need replacing
55-
auto const db_type = options.db_type.empty() ? "duckdb" : options.db_type;
56-
if (existing_db->GetCatalog().GetDBPath() == path &&
57-
existing_db->GetCatalog().GetCatalogType() == db_type) {
54+
// allow custom catalogs to override this behavior
55+
if (!existing_db->GetCatalog().HasConflictingAttachOptions(path, options)) {
5856
return SourceResultType::FINISHED;
5957
}
6058
} else {
@@ -63,9 +61,11 @@ SourceResultType PhysicalAttach::GetData(ExecutionContext &context, DataChunk &c
6361
}
6462
}
6563

66-
// Get the database type and attach the database.
67-
db_manager.GetDatabaseType(context.client, *info, config, options);
64+
// attach the database.
6865
auto attached_db = db_manager.AttachDatabase(context.client, *info, options);
66+
if (!attached_db) {
67+
return SourceResultType::FINISHED;
68+
}
6969

7070
//! Initialize the database.
7171
attached_db->Initialize(context.client);

src/duckdb/src/function/table/table_scan.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ class DuckTableScanState : public TableScanGlobalState {
265265
l_state.scan_state.options.force_fetch_row = ClientConfig::GetConfig(context).force_fetch_row;
266266

267267
do {
268+
if (context.interrupted) {
269+
throw InterruptException();
270+
}
268271
if (bind_data.is_create_index) {
269272
storage.CreateIndexScan(l_state.scan_state, output,
270273
TableScanType::TABLE_SCAN_COMMITTED_ROWS_OMIT_PERMANENTLY_DELETED);

src/duckdb/src/function/table/version/pragma_version.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "0-dev4120"
2+
#define DUCKDB_PATCH_VERSION "0-dev4146"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 4
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.4.0-dev4120"
11+
#define DUCKDB_VERSION "v1.4.0-dev4146"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "f8761864ef"
14+
#define DUCKDB_SOURCE_ID "19dd651b26"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/catalog/catalog.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <functional>
2727

2828
namespace duckdb {
29+
struct AttachOptions;
2930
struct CreateSchemaInfo;
3031
struct DropInfo;
3132
struct BoundCreateTableInfo;
@@ -346,6 +347,9 @@ class Catalog {
346347
//! Returns the dependency manager of this catalog - if the catalog has anye
347348
virtual optional_ptr<DependencyManager> GetDependencyManager();
348349

350+
//! Whether attaching a catalog with the given path and attach options would be considered a conflict
351+
virtual bool HasConflictingAttachOptions(const string &path, const AttachOptions &options);
352+
349353
public:
350354
template <class T>
351355
static optional_ptr<T> GetEntry(ClientContext &context, const string &catalog_name, const string &schema_name,

src/duckdb/src/include/duckdb/main/attached_database.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class StorageExtension;
2323
class DatabaseManager;
2424

2525
struct AttachInfo;
26+
struct StoredDatabasePath;
2627

2728
enum class AttachedDatabaseType {
2829
READ_WRITE_DATABASE,
@@ -31,11 +32,13 @@ enum class AttachedDatabaseType {
3132
TEMP_DATABASE,
3233
};
3334

35+
class DatabaseFilePathManager;
36+
3437
struct StoredDatabasePath {
35-
StoredDatabasePath(DatabaseManager &manager, string path, const string &name);
38+
StoredDatabasePath(DatabaseFilePathManager &manager, string path, const string &name);
3639
~StoredDatabasePath();
3740

38-
DatabaseManager &manager;
41+
DatabaseFilePathManager &manager;
3942
string path;
4043
};
4144

@@ -55,6 +58,8 @@ struct AttachOptions {
5558
unordered_map<string, Value> options;
5659
//! (optionally) a catalog can be provided with a default table
5760
QualifiedName default_table;
61+
//! The stored database path (in the path manager)
62+
unique_ptr<StoredDatabasePath> stored_database_path;
5863
};
5964

6065
//! The AttachedDatabase represents an attached database instance.
@@ -105,9 +110,6 @@ class AttachedDatabase : public CatalogEntry, public enable_shared_from_this<Att
105110
static bool NameIsReserved(const string &name);
106111
static string ExtractDatabaseName(const string &dbpath, FileSystem &fs);
107112

108-
private:
109-
void InsertDatabasePath(const string &path);
110-
111113
private:
112114
DatabaseInstance &db;
113115
unique_ptr<StoredDatabasePath> stored_database_path;

src/duckdb/src/include/duckdb/main/database_file_path_manager.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,20 @@
1111
#include "duckdb/common/common.hpp"
1212
#include "duckdb/common/mutex.hpp"
1313
#include "duckdb/common/case_insensitive_map.hpp"
14+
#include "duckdb/common/enums/on_create_conflict.hpp"
1415

1516
namespace duckdb {
17+
struct AttachInfo;
18+
struct AttachOptions;
19+
20+
enum class InsertDatabasePathResult { SUCCESS, ALREADY_EXISTS };
1621

1722
//! The DatabaseFilePathManager is used to ensure we only ever open a single database file once
1823
class DatabaseFilePathManager {
1924
public:
20-
void CheckPathConflict(const string &path, const string &name) const;
2125
idx_t ApproxDatabaseCount() const;
22-
void InsertDatabasePath(const string &path, const string &name);
26+
InsertDatabasePathResult InsertDatabasePath(const string &path, const string &name, OnCreateConflict on_conflict,
27+
AttachOptions &options);
2328
void EraseDatabasePath(const string &path);
2429

2530
private:

src/duckdb/src/include/duckdb/main/database_manager.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,7 @@ class DatabaseManager {
6767
void SetDefaultDatabase(ClientContext &context, const string &new_value);
6868

6969
//! Inserts a path to name mapping to the database paths map
70-
void InsertDatabasePath(const string &path, const string &name);
71-
//! Erases a path from the database paths map
72-
void EraseDatabasePath(const string &path);
73-
//! Check if a path has a conflict
74-
void CheckPathConflict(const string &path, const string &name);
70+
InsertDatabasePathResult InsertDatabasePath(const AttachInfo &info, AttachOptions &options);
7571

7672
//! Returns the database type. This might require checking the header of the file, in which case the file handle is
7773
//! necessary. We can only grab the file handle, if it is not yet held, even for uncommitted changes. Thus, we have

src/duckdb/src/include/duckdb/main/extension_entries.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,8 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
558558
{"st_area_spheroid", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
559559
{"st_asgeojson", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
560560
{"st_ashexwkb", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
561+
{"st_asmvt", "spatial", CatalogType::AGGREGATE_FUNCTION_ENTRY},
562+
{"st_asmvtgeom", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
561563
{"st_assvg", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
562564
{"st_astext", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
563565
{"st_aswkb", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},

0 commit comments

Comments
 (0)