hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odiache...@apache.org
Subject incubator-hawq git commit: HAWQ-997. Added type modifiers for varchar and bpchar.
Date Tue, 23 Aug 2016 21:45:29 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-997 fe904a8bc -> 08e795332


HAWQ-997. Added type modifiers for varchar and bpchar.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/08e79533
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/08e79533
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/08e79533

Branch: refs/heads/HAWQ-997
Commit: 08e795332a223392515fadbb7c5f1d3ad8bfe3e2
Parents: fe904a8
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Tue Aug 23 14:45:25 2016 -0700
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Tue Aug 23 14:45:25 2016 -0700

----------------------------------------------------------------------
 src/backend/access/external/pxfheaders.c | 28 ++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/08e79533/src/backend/access/external/pxfheaders.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/pxfheaders.c b/src/backend/access/external/pxfheaders.c
index 3cf3cdb..f1be919 100644
--- a/src/backend/access/external/pxfheaders.c
+++ b/src/backend/access/external/pxfheaders.c
@@ -162,12 +162,12 @@ static void add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation
rel)
         appendStringInfo(&formatter, "X-GP-ATTR-TYPENAME%u", i);
         churl_headers_append(headers, formatter.data, TypeOidGetTypename(tuple->attrs[i]->atttypid));
 
-        /* Add attribute type modifiers if any*/
-		switch (tuple->attrs[i]->atttypid)
+		/* Add attribute type modifiers if any*/
+		if (tuple->attrs[i]->atttypmod > -1)
 		{
-			case NUMERICOID:
+			switch (tuple->attrs[i]->atttypid)
 			{
-				if (tuple->attrs[i]->atttypmod > -1)
+				case NUMERICOID: {
 
 					/* precision */
 					resetStringInfo(&formatter);
@@ -178,16 +178,22 @@ static void add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation
rel)
 					/* scale */
 					resetStringInfo(&formatter);
 					appendStringInfo(&formatter, "X-GP-ATTR%u-TYPEMOD%u", i, 1);
-					pg_ltoa((tuple->attrs[i]->atttypmod) & 0xffff, long_number);
+					pg_ltoa((tuple->attrs[i]->atttypmod - VARHDRSZ) & 0xffff, long_number);
 					churl_headers_append(headers, formatter.data, long_number);
-
-				break;
+					break;
+				}
+				case VARCHAROID:
+				case BPCHAROID:
+					resetStringInfo(&formatter);
+					appendStringInfo(&formatter, "X-GP-ATTR%u-TYPEMOD%u", i, 0);
+					pg_ltoa((tuple->attrs[i]->atttypmod - VARHDRSZ), long_number);
+					churl_headers_append(headers, formatter.data, long_number);
+					break;
+				default:
+					break;
 			}
-			default:
-				break;
 		}
-
-    }
+	}
 	
 	pfree(formatter.data);
 }


Mime
View raw message