Skip to content

Commit 88bd701

Browse files
committed
Support DuckDB v1.4
1 parent 44a4dc4 commit 88bd701

File tree

8 files changed

+22
-24
lines changed

8 files changed

+22
-24
lines changed

.github/workflows/MainDistributionPipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
duckdb-next-build:
1616
name: Build extension binaries
1717
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main
18-
if: false # extension-template is currently not compatible with main
1918
with:
2019
duckdb_version: main
2120
ci_tools_version: main
2221
enable_rust: true
22+
exclude_archs: windows_amd64;windows_amd64_mingw;wasm_mvp;wasm_eh;wasm_threads
2323
extension_name: mooncake
2424

2525
duckdb-stable-build:

duckdb

Submodule duckdb updated 3358 files

src/include/mooncake_extension.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace duckdb {
66

77
class MooncakeExtension : public Extension {
88
public:
9-
void Load(DuckDB &db) override;
9+
void Load(ExtensionLoader &loader) override;
1010

1111
string Name() override;
1212

src/mooncake_extension.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
namespace duckdb {
1010

11-
void MooncakeExtension::Load(DuckDB &db) {
12-
auto &config = DBConfig::GetConfig(*db.instance);
11+
void MooncakeExtension::Load(ExtensionLoader &loader) {
12+
auto &db = loader.GetDatabaseInstance();
13+
auto &config = DBConfig::GetConfig(db);
1314
config.storage_extensions["mooncake"] = make_uniq<MooncakeStorageExtension>();
1415

1516
string init_query = Pgmooncake::GetInitQuery();
@@ -33,12 +34,7 @@ string MooncakeExtension::Version() const {
3334
} // namespace duckdb
3435

3536
extern "C" {
36-
DUCKDB_EXTENSION_API void mooncake_init(duckdb::DatabaseInstance &db) {
37-
duckdb::DuckDB db_wrapper(db);
38-
db_wrapper.LoadExtension<duckdb::MooncakeExtension>();
39-
}
40-
41-
DUCKDB_EXTENSION_API const char *mooncake_version() {
42-
return duckdb::DuckDB::LibraryVersion();
37+
DUCKDB_CPP_EXTENSION_ENTRY(mooncake, loader) {
38+
duckdb::MooncakeExtension().Load(loader);
4339
}
4440
}

src/storage/mooncake_scan.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
22
#include "duckdb/common/multi_file/multi_file_reader.hpp"
3-
#include "duckdb/main/extension_util.hpp"
3+
#include "duckdb/main/extension_helper.hpp"
44
#include "duckdb/parser/tableref/table_function_ref.hpp"
55
#include "parquet_reader.hpp"
66
#include "storage/mooncake_table.hpp"
@@ -106,7 +106,7 @@ struct MooncakeMultiFileReader : public MultiFileReader {
106106
return make_uniq<MooncakeMultiFileReader>(table_function.function_info->Cast<MooncakeFunctionInfo>().table);
107107
}
108108

109-
shared_ptr<MultiFileList> CreateFileList(ClientContext &, const vector<string> &, FileGlobOptions) override {
109+
shared_ptr<MultiFileList> CreateFileList(ClientContext &, const vector<string> &, const FileGlobInput &) override {
110110
return make_shared_ptr<MooncakeMultiFileList>(table);
111111
}
112112

@@ -135,7 +135,9 @@ struct MooncakeMultiFileReader : public MultiFileReader {
135135
};
136136

137137
static TableFunction &GetParquetScan(ClientContext &context) {
138-
return ExtensionUtil::GetTableFunction(*context.db, "parquet_scan").functions.GetFunctionReferenceByOffset(0);
138+
ExtensionHelper::AutoLoadExtension(*context.db, "parquet");
139+
ExtensionLoader loader(*context.db, "mooncake");
140+
return loader.GetTableFunction("parquet_scan").functions.GetFunctionReferenceByOffset(0);
139141
}
140142

141143
static unique_ptr<GlobalTableFunctionState> MooncakeScanInitGlobal(ClientContext &context,

src/storage/mooncake_schema.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ optional_ptr<CatalogEntry> MooncakeSchema::LookupEntry(CatalogTransaction transa
8686
throw InternalException("Error decoding schema: %s", ArrowErrorMessage(&error));
8787
}
8888

89-
ArrowTableType arrow_table;
90-
vector<string> names;
91-
vector<LogicalType> return_types;
92-
ArrowTableFunction::PopulateArrowTableType(transaction.db->config, arrow_table, schema, names, return_types);
89+
ArrowTableSchema arrow_table;
90+
ArrowTableFunction::PopulateArrowTableSchema(transaction.db->config, arrow_table, schema.arrow_schema);
91+
auto &names = arrow_table.GetNames();
92+
auto &types = arrow_table.GetTypes();
9393

9494
CreateTableInfo table_info;
9595
table_info.table = table_name;
9696
for (idx_t i = 0; i < names.size(); i++) {
97-
table_info.columns.AddColumn(ColumnDefinition(names[i], return_types[i]));
97+
table_info.columns.AddColumn(ColumnDefinition(names[i], types[i]));
9898
}
9999
tables[table_name] = make_uniq<MooncakeTable>(catalog, *this, table_info, lsn, moonlink);
100100
return *tables[table_name];

src/storage/mooncake_storage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace duckdb {
66

7-
unique_ptr<Catalog> MooncakeAttach(StorageExtensionInfo *storage_info, ClientContext &context, AttachedDatabase &db,
8-
const string &name, AttachInfo &info, AccessMode access_mode) {
7+
unique_ptr<Catalog> MooncakeAttach(optional_ptr<StorageExtensionInfo> storage_info, ClientContext &context,
8+
AttachedDatabase &db, const string &name, AttachInfo &info, AttachOptions &options) {
99
string uri;
1010
string database;
1111
for (auto &entry : info.options) {
@@ -29,7 +29,7 @@ unique_ptr<Catalog> MooncakeAttach(StorageExtensionInfo *storage_info, ClientCon
2929
return make_uniq<MooncakeCatalog>(db, std::move(uri), std::move(database));
3030
}
3131

32-
unique_ptr<TransactionManager> MooncakeCreateTransactionManager(StorageExtensionInfo *storage_info,
32+
unique_ptr<TransactionManager> MooncakeCreateTransactionManager(optional_ptr<StorageExtensionInfo> storage_info,
3333
AttachedDatabase &db, Catalog &catalog) {
3434
return make_uniq<MooncakeTransactionManager>(db, catalog);
3535
}

0 commit comments

Comments
 (0)