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 9b8a8a6b0e674fc0a211707f7393aa54347502e4
Author: Himanshu Pandey <[email protected]>
AuthorDate: Fri Nov 18 08:56:44 2022 -0800

    Address PR Feedback
---
 concourse/docker/rpmrebuild/rhel/Dockerfile |  2 --
 external-table/src/gpdbwritableformatter.c  | 41 +++++++++++++----------------
 external-table/src/pxfheaders.c             |  2 +-
 external-table/src/pxfuriparser.c           |  2 +-
 4 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/concourse/docker/rpmrebuild/rhel/Dockerfile 
b/concourse/docker/rpmrebuild/rhel/Dockerfile
index 05b9364f..54b3392d 100644
--- a/concourse/docker/rpmrebuild/rhel/Dockerfile
+++ b/concourse/docker/rpmrebuild/rhel/Dockerfile
@@ -14,5 +14,3 @@ RUN rpmbuild --rebuild rpmrebuild-*.src.rpm \
     && rpm -i /root/rpmbuild/RPMS/noarch/rpmrebuild-*.el8.noarch.rpm \
     && rm rpmrebuild-*.src.rpm \
     && rm -rf /root/rpmbuild
-
-RUN yum install libcgroup-tools
diff --git a/external-table/src/gpdbwritableformatter.c 
b/external-table/src/gpdbwritableformatter.c
index fc08cd24..d18b7e44 100644
--- a/external-table/src/gpdbwritableformatter.c
+++ b/external-table/src/gpdbwritableformatter.c
@@ -101,7 +101,7 @@ typedef struct
 /* for backward compatibility */
 #define GPDBWRITABLE_PREV_VERSION 1
 
-#define FORMATTER_ENCODING_ERR_MSG "pxfwritable_%1$s formatter can only %1$s 
UTF8 formatted data. Define the external table with ENCODING UTF8"
+#define FORMATTER_ENCODING_ERR_MSG "gpdbwritable formatter can only %s UTF8 
formatted data. Define the external table with ENCODING UTF8"
 
 /* Bit flag */
 #define GPDBWRITABLE_BITFLAG_ISNULL 1  /* Column is null */
@@ -501,7 +501,7 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
        nvalidcolumns = 0;
        for (i = 0; i < ncolumns; i++)
        {
-        Form_pg_attribute attr = getAttributeFromTupleDesc(tupdesc,i);
+            Form_pg_attribute attr = getAttributeFromTupleDesc(tupdesc,i);
 
                if (!attr->attisdropped)
                        nvalidcolumns++;
@@ -518,22 +518,19 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
         if (FORMATTER_GET_EXTENCODING(fcinfo) != PG_UTF8)
         {
                  ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                            errmsg("gpdbwritable formatter can only export 
UTF8 formatted data. Define the external table with ENCODING UTF8")));
+                            errmsg(FORMATTER_ENCODING_ERR_MSG, "export")));
         }
 #else
         Relation rel = FORMATTER_GET_RELATION(fcinfo);
-        if(rel != NULL)
-        {
-            ExtTableEntry *exttbl = GetExtTableEntry(rel->rd_id);
-            if (exttbl->encoding != PG_UTF8) {
-                ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                        errmsg("gpdbwritable formatter can only export UTF8 
formatted data. Define the external table with ENCODING UTF8")));
-            }
+        if(rel == NULL) {
+            ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+                            errmsg(FORMATTER_ENCODING_ERR_MSG, "export")));
         }
-        // TODO: If for some reason the Relation is null here, then shall we 
throw an error anyways ??
-        else{
+
+        ExtTableEntry *exttbl = GetExtTableEntry(rel->rd_id);
+        if (exttbl->encoding != PG_UTF8) {
             ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                    errmsg("gpdbwritable formatter can only export UTF8 
formatted data. Define the external table with ENCODING UTF8")));
+                    errmsg(FORMATTER_ENCODING_ERR_MSG, "export")));
         }
 #endif
 
@@ -794,22 +791,20 @@ gpdbwritableformatter_import(PG_FUNCTION_ARGS)
             if (FORMATTER_GET_EXTENCODING(fcinfo) != PG_UTF8)
             {
                      ereport(ERROR, 
(errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                                errmsg("gpdbwritable formatter can only import 
UTF8 formatted data. Define the external table with ENCODING UTF8")));
+                                errmsg(FORMATTER_ENCODING_ERR_MSG, "import")));
             }
 #else
-        Relation rel = FORMATTER_GET_RELATION(fcinfo);
-        if(rel != NULL) {
+            Relation rel = FORMATTER_GET_RELATION(fcinfo);
+            if(rel == NULL) {
+                ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+                                    errmsg(FORMATTER_ENCODING_ERR_MSG, 
"import")));
+            }
+
             ExtTableEntry *exttbl = GetExtTableEntry(rel->rd_id);
             if (exttbl->encoding != PG_UTF8) {
                 ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                        errmsg("gpdbwritable formatter can only import UTF8 
formatted data. Define the external table with ENCODING UTF8")));
+                        errmsg(FORMATTER_ENCODING_ERR_MSG, "import")));
             }
-        }
-        // TODO: If for some reason the Relation is null here, then shall we 
throw an error anyways ??
-        else{
-            ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                    errmsg("gpdbwritable formatter can only import UTF8 
formatted data. Define the external table with ENCODING UTF8")));
-        }
 #endif
 
                myData = palloc(sizeof(format_t));
diff --git a/external-table/src/pxfheaders.c b/external-table/src/pxfheaders.c
index 251add4e..da7887b1 100644
--- a/external-table/src/pxfheaders.c
+++ b/external-table/src/pxfheaders.c
@@ -735,7 +735,7 @@ add_projection_desc_httpheader_pg12(CHURL_HEADERS headers,
   pg_ltoa(number, long_number);
   churl_headers_append(headers, "X-GP-ATTRS-PROJ", long_number);
 
-    for (i = 0;varNumbers && i < numSimpleVars ; i++)
+    for (i = 0; i < numSimpleVars ; i++)
   {
     attrs_used =
       bms_add_member(attrs_used,
diff --git a/external-table/src/pxfuriparser.c 
b/external-table/src/pxfuriparser.c
index e251e0c9..eeee64d6 100644
--- a/external-table/src/pxfuriparser.c
+++ b/external-table/src/pxfuriparser.c
@@ -291,7 +291,7 @@ GPHDUri_verify_no_duplicate_options(GPHDUri *uri)
        {
                OptionData *data = (OptionData *) lfirst(option);
 
-// For GP 5.x latest ( 5.29.8) the server_version_num is 80323.
+// For GP 5.x latest (5.29.8) the server_version_num is 80323.
 // For 6.x or later str_toupper doesn't work as it has different signature ( 
one extra parameter) so the asc_toupper will work for 6.x or 7.x
 #if PG_VERSION_NUM <= 80323
                Value      *key = makeString(str_toupper(data->key, 
strlen(data->key)));


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

Reply via email to