You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by dj...@apache.org on 2025/12/18 08:21:06 UTC
(cloudberry-pxf) 01/37: Address PR feedback
This is an automated email from the ASF dual-hosted git repository.
djwang pushed a commit to branch merge-with-upstream
in repository https://gitbox.apache.org/repos/asf/cloudberry-pxf.git
commit 68c54cdbddbd698e5bed57e558792cffea604666
Author: Himanshu Pandey <pa...@vmware.com>
AuthorDate: Tue Sep 6 13:55:29 2022 -0700
Address PR feedback
---
Makefile | 61 +++++++++------------------
external-table/src/gpdbwritableformatter.c | 68 ++++++++++++++++++++++++------
external-table/src/pxfuriparser.h | 2 +-
3 files changed, 75 insertions(+), 56 deletions(-)
diff --git a/Makefile b/Makefile
index 24ad16a7..907977ea 100644
--- a/Makefile
+++ b/Makefile
@@ -13,28 +13,8 @@ ifndef PGXS
endif
include $(PGXS)
-# variables that control whether the FDW extension will be built and packaged,
-# if left empty there is no skipping, otherwise a value should contain a reason for skipping
-ifeq ($(shell test $(GP_MAJORVERSION) -lt 6; echo $$?),0)
- SKIP_FDW_BUILD_REASON := "GPDB version $(GP_MAJORVERSION) is less than 6."
-endif
-ifeq ($(shell test $(GP_MAJORVERSION) -lt 7; echo $$?),0)
- SKIP_FDW_PACKAGE_REASON := "GPDB version $(GP_MAJORVERSION) is less than 7."
-endif
-
-ifeq ($(BLD_ARCH),)
- GP_BUILD_ARCH := $(PORTNAME)-$(subst _,-,$(host_cpu))
-else
- GP_BUILD_ARCH := $(subst _,-,$(BLD_ARCH))
-endif
-
-export SKIP_FDW_BUILD_REASON
-export SKIP_FDW_PACKAGE_REASON
-export GP_MAJORVERSION
-export GP_BUILD_ARCH
-
-PXF_PACKAGE_NAME := pxf-gpdb$(GP_MAJORVERSION)-$(PXF_VERSION)-$(GP_BUILD_ARCH)
-export PXF_PACKAGE_NAME
+SOURCE_EXTENSION_DIR = external-table
+TARGET_EXTENSION_DIR = gpextable
LICENSE ?= ASL 2.0
VENDOR ?= Open Source
@@ -53,21 +33,24 @@ external-table cli server:
make -C $@
fdw:
-ifeq ($(SKIP_FDW_BUILD_REASON),)
- @echo "===> Compiling [$@] module <==="
+ifneq ($(FDW_SUPPORT),)
make -C fdw
-else
- @echo "Skipping building FDW extension because $(SKIP_FDW_BUILD_REASON)"
endif
+cli:
+ make -C cli/go/src/pxf-cli
+
+server:
+ make -C server
+
clean:
rm -rf build
- set -e ;\
- for module in $${PXF_MODULES[@]}; do \
- echo "===> Cleaning [$${module}] module <===" ;\
- make -C $${module} clean-all ;\
- done ;\
- echo "===> PXF cleaning is complete <==="
+ make -C $(SOURCE_EXTENSION_DIR) clean-all
+ make -C cli/go/src/pxf-cli clean
+ make -C server clean
+ifneq ($(FDW_SUPPORT),)
+ make -C fdw clean
+endif
test:
ifeq ($(SKIP_FDW_BUILD_REASON),)
@@ -82,16 +65,12 @@ it:
make -C automation TEST=$(TEST)
install:
-ifneq ($(SKIP_FDW_BUILD_REASON),)
- @echo "Skipping installing FDW extension because $(SKIP_FDW_BUILD_REASON)"
- $(eval PXF_MODULES := $(filter-out fdw,$(PXF_MODULES)))
+ make -C $(SOURCE_EXTENSION_DIR) install
+ make -C cli/go/src/pxf-cli install
+ make -C server install
+ifneq ($(FDW_SUPPORT),)
+ make -C fdw install
endif
- set -e ;\
- for module in $${PXF_MODULES[@]}; do \
- echo "===> Installing [$${module}] module <===" ;\
- make -C $${module} install ;\
- done ;\
- echo "===> PXF installation is complete <==="
install-server:
make -C server install-server
diff --git a/external-table/src/gpdbwritableformatter.c b/external-table/src/gpdbwritableformatter.c
index 9682c129..9885c3f0 100644
--- a/external-table/src/gpdbwritableformatter.c
+++ b/external-table/src/gpdbwritableformatter.c
@@ -343,13 +343,17 @@ boolArrayToByteArray(bool *data, int len, int validlen, int *outlen, TupleDesc t
*outlen = getNullByteArraySize(validlen);
result = palloc0(*outlen * sizeof(bits8));
+
for (i = 0, j = 0, k = 7; i < len; i++)
{
/* Ignore dropped attributes. */
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
- if (attr->attisdropped)
- continue;
+ if (attr->attisdropped) continue;
result[j] |= (data[i] ? 1 : 0) << k--;
if (k < 0)
@@ -392,7 +396,11 @@ byteArrayToBoolArray(bits8 *data, int data_len, int len, bool **booldata, int bo
for (i = 0, j = 0, k = 7; i < boollen; i++)
{
/* Ignore dropped attributes. */
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
if (attr->attisdropped)
{
@@ -432,11 +440,14 @@ verifyExternalTableDefinition(int16 ncolumns_remote, AttrNumber nvalidcolumns, A
/* Extract Column Type and check against External Table definition */
for (i = 0; i < ncolumns; i++)
{
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
/* Ignore dropped attributes. */
- if (attr->attisdropped)
- continue;
+ if (attr->attisdropped) continue;
input_type = 0;
defined_type = attr->atttypid;
@@ -501,7 +512,11 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
nvalidcolumns = 0;
for (i = 0; i < ncolumns; i++)
{
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
if (!attr->attisdropped)
nvalidcolumns++;
@@ -530,7 +545,11 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
/* setup the text/binary input function */
for (i = 0; i < ncolumns; i++)
{
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
Oid type = attr->atttypid;
bool isvarlena;
@@ -588,7 +607,11 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
*/
for (i = 0; i < ncolumns; i++)
{
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
/* Ignore dropped attributes. */
if (attr->attisdropped) continue;
@@ -674,7 +697,11 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
/* Write col type for columns that have not been dropped */
for (i = 0; i < ncolumns; i++)
{
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
/* Ignore dropped attributes. */
if (!attr->attisdropped)
@@ -691,7 +718,11 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
/* Column Value */
for (i = 0; i < ncolumns; i++)
{
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
/* Ignore dropped attributes and null values. */
if (!attr->attisdropped && !myData->nulls[i])
@@ -758,7 +789,12 @@ gpdbwritableformatter_import(PG_FUNCTION_ARGS)
/* Get the number of valid columns, excluding dropped columns */
for (i = 0; i < ncolumns; i++)
{
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
+
if (!attr->attisdropped)
nvalidcolumns++;
}
@@ -784,7 +820,11 @@ gpdbwritableformatter_import(PG_FUNCTION_ARGS)
for (i = 0; i < ncolumns; i++)
{
- Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+ #if PG_VERSION_NUM > 90400
+ Form_pg_attribute attr = &tupdesc->attrs[i];
+ #else
+ Form_pg_attribute attr = tupdesc->attrs[i];
+ #endif
Oid type = attr->atttypid;
diff --git a/external-table/src/pxfuriparser.h b/external-table/src/pxfuriparser.h
index f52de266..b007ea80 100644
--- a/external-table/src/pxfuriparser.h
+++ b/external-table/src/pxfuriparser.h
@@ -24,7 +24,7 @@
#include "nodes/pg_list.h"
#include "fmgr.h"
#include "utils/builtins.h"
-#if PG_VERSION_NUM >= 120000
+#if PG_VERSION_NUM >= 90600
#include "lib/stringinfo.h"
#include "nodes/value.h"
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org