hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject [1/4] incubator-hawq git commit: [HAWQ-19] Minor fixes for supporting 8-byte money datatype on Parquet
Date Mon, 22 Feb 2016 03:02:28 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 1a29a073a -> 083aaf66d


[HAWQ-19] Minor fixes for supporting 8-byte money datatype on Parquet


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

Branch: refs/heads/master
Commit: ef09b00f6a04488b314cd5e826d0174ed974abc9
Parents: 1c154ea
Author: Alexey Grishchenko <agrishchenko@pivotal.io>
Authored: Thu Feb 4 02:53:38 2016 -0800
Committer: Ming LI <mli@pivotal.io>
Committed: Mon Feb 22 11:00:14 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbparquetcolumn.c       |  2 +-
 src/backend/cdb/cdbparquetstoragewrite.c | 17 +++++++++--------
 src/include/catalog/pg_type.sql          |  4 ++--
 3 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/ef09b00f/src/backend/cdb/cdbparquetcolumn.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbparquetcolumn.c b/src/backend/cdb/cdbparquetcolumn.c
index be437f7..89ce684 100644
--- a/src/backend/cdb/cdbparquetcolumn.c
+++ b/src/backend/cdb/cdbparquetcolumn.c
@@ -486,7 +486,7 @@ decodePlain(Datum *value, uint8_t **buffer, int hawqTypeID)
 			 * should be a pointer, see cash.c
 			 */
 			(*value) = PointerGetDatum(*buffer);
-			(*buffer) += 4;
+			(*buffer) += 8;
 			break;
 		}
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/ef09b00f/src/backend/cdb/cdbparquetstoragewrite.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbparquetstoragewrite.c b/src/backend/cdb/cdbparquetstoragewrite.c
index 577b327..6b5f847 100644
--- a/src/backend/cdb/cdbparquetstoragewrite.c
+++ b/src/backend/cdb/cdbparquetstoragewrite.c
@@ -653,7 +653,6 @@ mappingHAWQType(int hawqTypeID)
 
 	case HAWQ_TYPE_INT2:
 	case HAWQ_TYPE_INT4:
-	case HAWQ_TYPE_MONEY:
 	case HAWQ_TYPE_DATE:
 		return INT32;
 
@@ -661,6 +660,7 @@ mappingHAWQType(int hawqTypeID)
 	case HAWQ_TYPE_TIME:
 	case HAWQ_TYPE_TIMESTAMPTZ:
 	case HAWQ_TYPE_TIMESTAMP:
+	case HAWQ_TYPE_MONEY:
 		return INT64;
 
 	case HAWQ_TYPE_FLOAT4:
@@ -1274,13 +1274,18 @@ encodePlain(Datum data,
 		memcpy(dst_ptr, &val, len);
 		return len;
 	}
+
+
+	/*----------------------------------------------------------------
+	 * Type mapped to 8-bytes INT64/DOUBLE in Parquet
+	 *----------------------------------------------------------------*/
 	case HAWQ_TYPE_MONEY:
 	{
 		/*
-		 * Although money is represented as int32 internally,
+		 * Although money is represented as int64 internally,
 		 * it's passed by reference.
 		 */
-		len = 4;
+		len = 8;
 		if (!ensureBufferCapacity(current_page, len, pageSizeLimit))
 		{
 			return ENCODE_OUTOF_PAGE;
@@ -1293,11 +1298,7 @@ encodePlain(Datum data,
 		memcpy(dst_ptr, cash_p, len);
 		return len;
 	}
-
-
-	/*----------------------------------------------------------------
-	 * Type mapped to 8-bytes INT64/DOUBLE in Parquet
-	 *----------------------------------------------------------------*/
+	
 	case HAWQ_TYPE_INT8:
 	{
 		len = 8;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/ef09b00f/src/include/catalog/pg_type.sql
----------------------------------------------------------------------
diff --git a/src/include/catalog/pg_type.sql b/src/include/catalog/pg_type.sql
index a491c75..ca159d9 100644
--- a/src/include/catalog/pg_type.sql
+++ b/src/include/catalog/pg_type.sql
@@ -388,9 +388,9 @@
    OUTPUT = cash_out,
    RECEIVE = cash_recv,
    SEND = cash_send,
-   INTERNALLENGTH = 4,
+   INTERNALLENGTH = 8,
    STORAGE = plain,
-   ALIGNMENT = int4
+   ALIGNMENT = double
  ) WITH (OID=790, ARRAYOID=791, DESCRIPTION="monetary amounts, $d,ddd.cc");
 -- #define CASHOID 790
 


Mime
View raw message