Skip to content

Commit

Permalink
arrow is also autoloadable
Browse files Browse the repository at this point in the history
  • Loading branch information
carlopi committed Sep 17, 2023
1 parent ffc4eeb commit 23ba3d2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/config/out_of_tree_extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ if (NOT WIN32)
duckdb_extension_load(arrow
LOAD_TESTS DONT_LINK
GIT_URL https://github.com/duckdblabs/arrow
GIT_TAG 1b5b9649d28cd7f79496fb3f2e4dd7b03bf90ac5
GIT_TAG 1B5B9649D28CD7F79496FB3F2E4DD7B03BF90AC5
APPLY_PATCHES
)
endif()

Expand Down
34 changes: 34 additions & 0 deletions .github/patches/extensions/arrow/autoload.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/arrow/arrow_extension.cpp b/arrow/arrow_extension.cpp
index 34a4021..9330c79 100644
--- a/arrow/arrow_extension.cpp
+++ b/arrow/arrow_extension.cpp
@@ -10,6 +10,7 @@
#include "duckdb/common/arrow/result_arrow_wrapper.hpp"
#include "duckdb/common/arrow/arrow_appender.hpp"
#include "duckdb/common/arrow/arrow_converter.hpp"
+#include "duckdb/main/extension_util.hpp"
#include "duckdb/parser/parsed_data/create_table_function_info.hpp"
#include "duckdb/function/table/arrow.hpp"
#endif
@@ -17,19 +18,11 @@
namespace duckdb {

static void LoadInternal(DatabaseInstance &instance) {
- Connection con(instance);
- con.BeginTransaction();
- auto &catalog = Catalog::GetSystemCatalog(*con.context);
-
auto to_arrow_fun = ToArrowIPCFunction::GetFunction();
- CreateTableFunctionInfo to_arrow_ipc_info(to_arrow_fun);
- catalog.CreateTableFunction(*con.context, &to_arrow_ipc_info);
+ ExtensionUtil::RegisterFunction(db, to_arrow_fun);

auto scan_arrow_fun = ArrowIPCTableFunction::GetFunction();
- CreateTableFunctionInfo scan_arrow_ipc_info(scan_arrow_fun);
- catalog.CreateTableFunction(*con.context, &scan_arrow_ipc_info);
-
- con.Commit();
+ ExtensionUtil::RegisterFunction(db, scan_arrow_fun);
}

void ArrowExtension::Load(DuckDB &db) {
1 change: 1 addition & 0 deletions src/include/duckdb/main/extension_entries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ static constexpr ExtensionEntry EXTENSION_FILE_CONTAINS[] = {{".parquet?", "parq

static constexpr const char *AUTOLOADABLE_EXTENSIONS[] = {
// "azure",
"arrow",
"aws",
"autocomplete",
"excel",
Expand Down

0 comments on commit 23ba3d2

Please sign in to comment.