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 7df14917424a7e46ed2450f04405f92ee775c2c7
Author: Himanshu Pandey <[email protected]>
AuthorDate: Thu Sep 8 13:49:01 2022 -0700

    Changes for compiling PXF with GPDB 6.x
---
 external-table/src/gpdbwritableformatter.c | 26 +++++++++++++++-----------
 external-table/src/pxfheaders.c            | 15 ++++++++++++---
 external-table/src/pxfuriparser.c          |  7 +++++--
 external-table/src/pxfuriparser.h          |  2 +-
 4 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/external-table/src/gpdbwritableformatter.c 
b/external-table/src/gpdbwritableformatter.c
index 9885c3f0..a76a836d 100644
--- a/external-table/src/gpdbwritableformatter.c
+++ b/external-table/src/gpdbwritableformatter.c
@@ -347,7 +347,7 @@ boolArrayToByteArray(bool *data, int len, int validlen, int 
*outlen, TupleDesc t
        for (i = 0, j = 0, k = 7; i < len; i++)
        {
                /* Ignore dropped attributes. */
-        #if PG_VERSION_NUM > 90400
+        #if PG_VERSION_NUM >= 120000
             Form_pg_attribute attr = &tupdesc->attrs[i];
         #else
             Form_pg_attribute attr = tupdesc->attrs[i];
@@ -396,7 +396,7 @@ 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. */
-        #if PG_VERSION_NUM > 90400
+        #if PG_VERSION_NUM >= 120000
             Form_pg_attribute attr = &tupdesc->attrs[i];
         #else
             Form_pg_attribute attr = tupdesc->attrs[i];
@@ -440,7 +440,7 @@ verifyExternalTableDefinition(int16 ncolumns_remote, 
AttrNumber nvalidcolumns, A
        /* Extract Column Type and check against External Table definition */
        for (i = 0; i < ncolumns; i++)
        {
-        #if PG_VERSION_NUM > 90400
+        #if PG_VERSION_NUM >= 120000
             Form_pg_attribute attr = &tupdesc->attrs[i];
         #else
             Form_pg_attribute attr = tupdesc->attrs[i];
@@ -512,7 +512,7 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
        nvalidcolumns = 0;
        for (i = 0; i < ncolumns; i++)
        {
-        #if PG_VERSION_NUM > 90400
+        #if PG_VERSION_NUM >= 120000
             Form_pg_attribute attr = &tupdesc->attrs[i];
         #else
             Form_pg_attribute attr = tupdesc->attrs[i];
@@ -545,7 +545,7 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
                /* setup the text/binary input function */
                for (i = 0; i < ncolumns; i++)
                {
-            #if PG_VERSION_NUM > 90400
+            #if PG_VERSION_NUM >= 120000
                 Form_pg_attribute attr = &tupdesc->attrs[i];
             #else
                 Form_pg_attribute attr = tupdesc->attrs[i];
@@ -607,7 +607,7 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
         */
        for (i = 0; i < ncolumns; i++)
        {
-        #if PG_VERSION_NUM > 90400
+        #if PG_VERSION_NUM >= 120000
             Form_pg_attribute attr = &tupdesc->attrs[i];
         #else
             Form_pg_attribute attr = tupdesc->attrs[i];
@@ -697,7 +697,7 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
        /* Write col type for columns that have not been dropped */
        for (i = 0; i < ncolumns; i++)
        {
-        #if PG_VERSION_NUM > 90400
+        #if PG_VERSION_NUM >= 120000
             Form_pg_attribute attr = &tupdesc->attrs[i];
         #else
             Form_pg_attribute attr = tupdesc->attrs[i];
@@ -718,7 +718,7 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
        /* Column Value */
        for (i = 0; i < ncolumns; i++)
        {
-        #if PG_VERSION_NUM > 90400
+        #if PG_VERSION_NUM >= 120000
             Form_pg_attribute attr = &tupdesc->attrs[i];
         #else
             Form_pg_attribute attr = tupdesc->attrs[i];
@@ -789,7 +789,7 @@ gpdbwritableformatter_import(PG_FUNCTION_ARGS)
        /* Get the number of valid columns, excluding dropped columns */
        for (i = 0; i < ncolumns; i++)
        {
-        #if PG_VERSION_NUM > 90400
+        #if PG_VERSION_NUM >= 120000
             Form_pg_attribute attr = &tupdesc->attrs[i];
         #else
             Form_pg_attribute attr = tupdesc->attrs[i];
@@ -820,7 +820,7 @@ gpdbwritableformatter_import(PG_FUNCTION_ARGS)
 
                for (i = 0; i < ncolumns; i++)
                {
-                       #if PG_VERSION_NUM > 90400
+                       #if PG_VERSION_NUM >= 120000
                                Form_pg_attribute attr = &tupdesc->attrs[i];
                        #else
                                Form_pg_attribute attr = tupdesc->attrs[i];
@@ -942,7 +942,11 @@ gpdbwritableformatter_import(PG_FUNCTION_ARGS)
        /* extract column value */
        for (i = 0; i < ncolumns; i++)
        {
-               Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+               #if PG_VERSION_NUM >= 120000
+                       Form_pg_attribute attr = &tupdesc->attrs[i];
+               #else
+                       Form_pg_attribute attr = tupdesc->attrs[i];
+               #endif
 
                /* Ignore dropped attributes. */
                if (attr->attisdropped)
diff --git a/external-table/src/pxfheaders.c b/external-table/src/pxfheaders.c
index 90db8701..1ab908ad 100644
--- a/external-table/src/pxfheaders.c
+++ b/external-table/src/pxfheaders.c
@@ -21,9 +21,9 @@
 #include "pxfheaders.h"
 #include "commands/defrem.h"
 #if PG_VERSION_NUM >= 120000
+#include "utils/timestamp.h"
 #include "access/external.h"
 #include "extension/gp_exttable_fdw/extaccess.h"
-#include "executor/execExpr.h"
 #else
 #include "access/fileam.h"
 #include "catalog/pg_exttable.h"
@@ -272,7 +272,11 @@ add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation 
rel)
        /* Iterate attributes */
        for (i = 0, attrIx = 0; i < tuple->natts; ++i)
        {
-               FormData_pg_attribute *attribute = TupleDescAttr(tuple, i);
+               #if PG_VERSION_NUM >= 120000
+                       Form_pg_attribute attribute = &tuple->attrs[i];
+               #else
+                       Form_pg_attribute attribute = tuple->attrs[i];
+               #endif
 
                /* Ignore dropped attributes. */
                if (attribute->attisdropped)
@@ -570,8 +574,13 @@ add_projection_desc_httpheaders(CHURL_HEADERS headers,
 
        for (i = 1; i <= tupdesc->natts; i++)
        {
+        #if PG_VERSION_NUM >= 120000
+            Form_pg_attribute attr = &tupdesc->attrs[i];
+        #else
+            Form_pg_attribute attr = tupdesc->attrs[i];
+        #endif
                /* Ignore dropped attributes. */
-               if (TupleDescAttr(tupdesc, i - 1)->attisdropped)
+               if (attr->attisdropped)
                {
                        /* keep a counter of the number of dropped attributes */
                        droppedCount++;
diff --git a/external-table/src/pxfuriparser.c 
b/external-table/src/pxfuriparser.c
index 47fce006..52f18af9 100644
--- a/external-table/src/pxfuriparser.c
+++ b/external-table/src/pxfuriparser.c
@@ -290,8 +290,11 @@ GPHDUri_verify_no_duplicate_options(GPHDUri *uri)
        foreach(option, uri->options)
        {
                OptionData *data = (OptionData *) lfirst(option);
-
-               Value      *key = makeString(asc_toupper(data->key, 
strlen(data->key)));
+               #if PG_VERSION_NUM >= 120000
+                               Value      *key = 
makeString(asc_toupper(data->key, strlen(data->key)));
+               #else
+                               Value      *key = 
makeString(str_toupper(data->key, strlen(data->key)));
+               #endif
 
                if (!list_member(previousKeys, key))
                        previousKeys = lappend(previousKeys, key);
diff --git a/external-table/src/pxfuriparser.h 
b/external-table/src/pxfuriparser.h
index b007ea80..f52de266 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 >= 90600
+#if PG_VERSION_NUM >= 120000
 #include "lib/stringinfo.h"
 #include "nodes/value.h"
 #endif


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to