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 other datatypes.
Date Wed, 24 Aug 2016 01:10:20 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-997 3fdde0b31 -> 9e37ee7c2


HAWQ-997. Added type modifiers for other datatypes.


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

Branch: refs/heads/HAWQ-997
Commit: 9e37ee7c26e093d68d4d654aa9e6aa0f558d4265
Parents: 3fdde0b
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Tue Aug 23 18:10:16 2016 -0700
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Tue Aug 23 18:10:16 2016 -0700

----------------------------------------------------------------------
 src/backend/access/external/pxfheaders.c | 44 ++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9e37ee7c/src/backend/access/external/pxfheaders.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/pxfheaders.c b/src/backend/access/external/pxfheaders.c
index 3125ea7..ed5aacc 100644
--- a/src/backend/access/external/pxfheaders.c
+++ b/src/backend/access/external/pxfheaders.c
@@ -121,12 +121,14 @@ static void add_alignment_size_httpheader(CHURL_HEADERS headers)
 
 /* 
  * Report tuple description to remote component 
- * Currently, number of attributes, attributes names and types 
+ * Currently, number of attributes, attributes names, types and types modifiers
  * Each attribute has a pair of key/value 
  * where X is the number of the attribute
  * X-GP-ATTR-NAMEX - attribute X's name 
  * X-GP-ATTR-TYPECODEX - attribute X's type OID (e.g, 16)
  * X-GP-ATTR-TYPENAMEX - attribute X's type name (e.g, "boolean")
+ * optional - X-GP-ATTR-TYPEMODX-COUNT - total number of modifier for attribute X's modifiers
+ * optional - X-GP-ATTR-TYPEMODX-Y - attribute X's modifiers Y (types which have precision
info, like numeric(p,s))
  */
 static void add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation rel)
 {	
@@ -167,16 +169,23 @@ static void add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation
rel)
 		{
 			switch (tuple->attrs[i]->atttypid)
 			{
-				case NUMERICOID: {
+				case NUMERICOID:
+				{
+					resetStringInfo(&formatter);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMODX-COUNT");
+					pg_ltoa(2, long_number);
+					churl_headers_append(headers, formatter.data, long_number);
+
+
 					/* precision */
 					resetStringInfo(&formatter);
-					appendStringInfo(&formatter, "X-GP-ATTR%u-TYPEMOD%u", i, 0);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMOD%u-%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);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMOD%u-%u", i, 1);
 					pg_ltoa((tuple->attrs[i]->atttypmod - VARHDRSZ) & 0xffff, long_number);
 					churl_headers_append(headers, formatter.data, long_number);
 					break;
@@ -184,28 +193,49 @@ static void add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation
rel)
 				case CHAROID:
 				case BPCHAROID:
 				case VARCHAROID:
+				{
 					resetStringInfo(&formatter);
-					appendStringInfo(&formatter, "X-GP-ATTR%u-TYPEMOD%u", i, 0);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMODX-COUNT");
+					pg_ltoa(1, long_number);
+					churl_headers_append(headers, formatter.data, long_number);
+
+					resetStringInfo(&formatter);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMOD%u-%u", i, 0);
 					pg_ltoa((tuple->attrs[i]->atttypmod - VARHDRSZ), long_number);
 					churl_headers_append(headers, formatter.data, long_number);
 					break;
+				}
 				case VARBITOID:
 				case BITOID:
 				case TIMESTAMPOID:
 				case TIMESTAMPTZOID:
 				case TIMEOID:
 				case TIMETZOID:
+				{
 					resetStringInfo(&formatter);
-					appendStringInfo(&formatter, "X-GP-ATTR%u-TYPEMOD%u", i, 0);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMODX-COUNT");
+					pg_ltoa(1, long_number);
+					churl_headers_append(headers, formatter.data, long_number);
+
+					resetStringInfo(&formatter);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMOD%u-%u", i, 0);
 					pg_ltoa((tuple->attrs[i]->atttypmod), long_number);
 					churl_headers_append(headers, formatter.data, long_number);
 					break;
+				}
 				case INTERVALOID:
+				{
 					resetStringInfo(&formatter);
-					appendStringInfo(&formatter, "X-GP-ATTR%u-TYPEMOD%u", i, 0);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMODX-COUNT");
+					pg_ltoa(1, long_number);
+					churl_headers_append(headers, formatter.data, long_number);
+
+					resetStringInfo(&formatter);
+					appendStringInfo(&formatter, "X-GP-ATTR-TYPEMOD%u-%u", i, 0);
 					pg_ltoa(INTERVAL_PRECISION(tuple->attrs[i]->atttypmod), long_number);
 					churl_headers_append(headers, formatter.data, long_number);
 					break;
+				}
 				default:
 					elog(DEBUG5, "add_tuple_desc_httpheader: unsupported type %d ", tuple->attrs[i]->atttypid);
 					break;


Mime
View raw message