-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove most C++ from pgduckdb.cpp
#498
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,21 @@ typedef enum { | |
MOTHERDUCK_AUTO, | ||
} MotherDuckEnabled; | ||
|
||
// pgduckdb.c | ||
// pgduckdb.cpp | ||
extern "C" void _PG_init(void); | ||
|
||
// pgduckdb_hooks.c | ||
void DuckdbInitHooks(void); | ||
void DuckdbInitGUC(); | ||
|
||
// pgduckdb_hooks.cpp | ||
void DuckdbInitHooks(); | ||
|
||
// pgduckdb_node.cpp | ||
void DuckdbInitNode(); | ||
|
||
// pgduckdb_background_worker.cpp | ||
void DuckdbInitBackgroundWorker(); | ||
|
||
namespace pgduckdb { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this starts containing |
||
// pgduckdb_xact.cpp | ||
void RegisterDuckdbXactCallback(); | ||
} // namespace pgduckdb |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,3 @@ extern "C" { | |
} | ||
|
||
extern CustomScanMethods duckdb_scan_scan_methods; | ||
extern "C" void DuckdbInitNode(void); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
#include "duckdb.hpp" | ||
#include "pgduckdb/pgduckdb.h" | ||
|
||
#include <type_traits> | ||
|
||
extern "C" { | ||
#include "postgres.h" | ||
#include "miscadmin.h" | ||
#include "utils/guc.h" | ||
} | ||
|
||
#include "pgduckdb/pgduckdb.h" | ||
#include "pgduckdb/pgduckdb_node.hpp" | ||
#include "pgduckdb/pgduckdb_background_worker.hpp" | ||
#include "pgduckdb/pgduckdb_xact.hpp" | ||
|
||
static void DuckdbInitGUC(void); | ||
|
||
bool duckdb_force_execution = false; | ||
int duckdb_max_threads_per_postgres_scan = 1; | ||
int duckdb_motherduck_enabled = MotherDuckEnabled::MOTHERDUCK_AUTO; | ||
|
@@ -99,6 +94,7 @@ DefineCustomVariable(const char *name, const char *short_desc, T *var, T min, T | |
} else { | ||
static_assert("Unsupported type"); | ||
} | ||
|
||
func(name, gettext_noop(short_desc), NULL, var, *var, min, max, context, flags, check_hook, assign_hook, show_hook); | ||
} | ||
|
||
|
@@ -122,8 +118,8 @@ static const struct config_enum_entry motherduck_enabled_options[] = { | |
}; | ||
/* clang-format on */ | ||
|
||
static void | ||
DuckdbInitGUC(void) { | ||
void | ||
DuckdbInitGUC() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related thought: I've been thinking we should probably move this GUC stuff to its own |
||
DefineCustomVariable("duckdb.force_execution", "Force queries to use DuckDB execution", &duckdb_force_execution); | ||
|
||
DefineCustomVariable("duckdb.enable_external_access", "Allow the DuckDB to access external state.", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move these functions to this header instead of leaving them defined where they were?