Skip to content

Introduce cloudberry_fdw to run queries between one and more CBDB clusters #1147

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions contrib/cloudberry_fdw/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated subdirectories
/log/
/results/
/tmp_check/
link-canary.c
58 changes: 58 additions & 0 deletions contrib/cloudberry_fdw/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# contrib/cloudberry_fdw/Makefile

MODULE_big = cloudberry_fdw
OBJS_FRONTEND = \
link-canary.o

OBJS = \
$(WIN32RES) \
$(OBJS_FRONTEND) \
connection.o \
deparse.o \
option.o \
cloudberry_fdw.o \
shippable.o

PGFILEDESC = "cloudberry_fdw - foreign data wrapper for Cloudberry"

PG_CPPFLAGS = -I$(libpq_srcdir)
SHLIB_LINK_INTERNAL = -Wl,-Bsymbolic -Wl,-Bstatic -Wl,-Bstatic $(libpq) -Wl,-Bdynamic

EXTENSION = cloudberry_fdw
DATA = cloudberry_fdw--1.0.sql cloudberry_fdw--1.0--1.1.sql

REGRESS = gp2pg_cloudberry_fdw gp_cloudberry_fdw mpp_cloudberry_fdw #cloudberry_fdw
REGRESS_OPTS += --init-file=$(top_srcdir)/src/test/regress/init_file

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
SHLIB_PREREQS = submake-libpq
subdir = contrib/cloudberry_fdw
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif

link-canary.c : % : $(top_srcdir)/src/common/%
rm -f $@ && $(LN_S) $< .

link-canary.o: link-canary.c
$(CC) $(CFLAGS) -DFRONTEND $(CPPFLAGS) -c $< -o $@

clean: clean-symlinks

clean-symlinks:
rm -f link-canary.c

# For cloudberry_fdw test
export PG_PORT=5432
installcheck: install prep_postgres
clean: clean_postgres
prep_postgres:
./postgres_setup.bash
clean_postgres:
./postgres_clean.bash
.PHONY: prep_postgres clean_postgres
20 changes: 20 additions & 0 deletions contrib/cloudberry_fdw/cloudberry_fdw--1.0--1.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* contrib/cloudberry_fdw/cloudberry_fdw--1.0--1.1.sql */

-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION cloudberry_fdw UPDATE TO '1.1'" to load this file. \quit

CREATE FUNCTION cloudberry_fdw_get_connections (OUT server_name text,
OUT valid boolean)
RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT PARALLEL RESTRICTED;

CREATE FUNCTION cloudberry_fdw_disconnect (text)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT PARALLEL RESTRICTED;

CREATE FUNCTION cloudberry_fdw_disconnect_all ()
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT PARALLEL RESTRICTED;
18 changes: 18 additions & 0 deletions contrib/cloudberry_fdw/cloudberry_fdw--1.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* contrib/cloudberry_fdw/cloudberry_fdw--1.0.sql */

-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION cloudberry_fdw" to load this file. \quit

CREATE FUNCTION cloudberry_fdw_handler()
RETURNS fdw_handler
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;

CREATE FUNCTION cloudberry_fdw_validator(text[], oid)
RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;

CREATE FOREIGN DATA WRAPPER cloudberry_fdw
HANDLER cloudberry_fdw_handler
VALIDATOR cloudberry_fdw_validator;
Loading
Loading