Skip to content

Commit 1bd8636

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

File tree

10 files changed

+30
-33
lines changed

10 files changed

+30
-33
lines changed
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#
2-
# This workflow calls the main distribution pipeline from DuckDB to build, test and (optionally) release the extension
3-
#
41
name: Main Extension Distribution Pipeline
52
on:
63
push:
@@ -15,19 +12,19 @@ jobs:
1512
duckdb-next-build:
1613
name: Build extension binaries
1714
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main
18-
if: false # extension-template is currently not compatible with main
1915
with:
2016
duckdb_version: main
2117
ci_tools_version: main
2218
enable_rust: true
19+
exclude_archs: windows_amd64;windows_amd64_mingw;wasm_mvp;wasm_eh;wasm_threads
2320
extension_name: mooncake
2421

2522
duckdb-stable-build:
2623
name: Build extension binaries
27-
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.3.2
24+
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.4.0
2825
with:
29-
duckdb_version: v1.3.2
30-
ci_tools_version: v1.3.2
26+
duckdb_version: v1.4.0
27+
ci_tools_version: v1.4.0
3128
enable_rust: true
3229
exclude_archs: windows_amd64;windows_amd64_mingw;wasm_mvp;wasm_eh;wasm_threads
3330
extension_name: mooncake
@@ -36,7 +33,7 @@ jobs:
3633
name: Code Quality Check
3734
uses: duckdb/extension-ci-tools/.github/workflows/_extension_code_quality.yml@main
3835
with:
39-
duckdb_version: v1.3.2
36+
duckdb_version: main
4037
ci_tools_version: main
4138
extension_name: mooncake
4239
format_checks: format

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
PROJ_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
22

3-
# Configuration of extension
43
EXT_NAME=mooncake
54
EXT_CONFIG=${PROJ_DIR}extension_config.cmake
65

7-
# Include the Makefile from extension-ci-tools
86
include extension-ci-tools/makefiles/duckdb_extension.Makefile
97

108
format-all:

duckdb

Submodule duckdb updated 3343 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: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
#include "duckdb/main/connection.hpp"
44
#include "duckdb/main/database.hpp"
5+
#include "duckdb/main/extension_helper.hpp"
56
#include "mooncake_extension.hpp"
67
#include "pgmooncake.hpp"
78
#include "storage/mooncake_storage.hpp"
89

910
namespace duckdb {
1011

11-
void MooncakeExtension::Load(DuckDB &db) {
12-
auto &config = DBConfig::GetConfig(*db.instance);
12+
void MooncakeExtension::Load(ExtensionLoader &loader) {
13+
auto &db = loader.GetDatabaseInstance();
14+
ExtensionHelper::AutoLoadExtension(db, "parquet");
15+
auto &config = DBConfig::GetConfig(db);
1316
config.storage_extensions["mooncake"] = make_uniq<MooncakeStorageExtension>();
1417

1518
string init_query = Pgmooncake::GetInitQuery();
@@ -33,12 +36,7 @@ string MooncakeExtension::Version() const {
3336
} // namespace duckdb
3437

3538
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();
39+
DUCKDB_CPP_EXTENSION_ENTRY(mooncake, loader) {
40+
duckdb::MooncakeExtension().Load(loader);
4341
}
4442
}

src/storage/mooncake_scan.cpp

Lines changed: 4 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/extension_loader.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,8 @@ struct MooncakeMultiFileReader : public MultiFileReader {
135135
};
136136

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

141142
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
}

vcpkg.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"vcpkg-configuration": {
66
"overlay-ports": [
77
"./extension-ci-tools/vcpkg_ports"
8+
],
9+
"overlay-triplets": [
10+
"./extension-ci-tools/toolchains"
811
]
912
}
1013
}

0 commit comments

Comments
 (0)