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 numeric.
Date Tue, 23 Aug 2016 20:54:04 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-997 [created] fe904a8bc


HAWQ-997. Added type modifiers for numeric.


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

Branch: refs/heads/HAWQ-997
Commit: fe904a8bced010ad9e52bbd878c643bd57fe2800
Parents: 7661dec
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Tue Aug 23 13:53:50 2016 -0700
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Tue Aug 23 13:53:50 2016 -0700

----------------------------------------------------------------------
 src/backend/access/external/pxfheaders.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/fe904a8b/src/backend/access/external/pxfheaders.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/pxfheaders.c b/src/backend/access/external/pxfheaders.c
index 45fcc35..3cf3cdb 100644
--- a/src/backend/access/external/pxfheaders.c
+++ b/src/backend/access/external/pxfheaders.c
@@ -161,6 +161,32 @@ static void add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation
rel)
         resetStringInfo(&formatter);
         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)
+		{
+			case NUMERICOID:
+			{
+				if (tuple->attrs[i]->atttypmod > -1)
+
+					/* precision */
+					resetStringInfo(&formatter);
+					appendStringInfo(&formatter, "X-GP-ATTR%u-TYPEMOD%u", i, 0);
+					pg_ltoa((tuple->attrs[i]->atttypmod >> 16) & 0xffff, long_number);
+					churl_headers_append(headers, formatter.data, long_number);
+
+					/* scale */
+					resetStringInfo(&formatter);
+					appendStringInfo(&formatter, "X-GP-ATTR%u-TYPEMOD%u", i, 1);
+					pg_ltoa((tuple->attrs[i]->atttypmod) & 0xffff, long_number);
+					churl_headers_append(headers, formatter.data, long_number);
+
+				break;
+			}
+			default:
+				break;
+		}
+
     }
 	
 	pfree(formatter.data);


Mime
View raw message