You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by ji...@apache.org on 2015/10/28 08:57:33 UTC

incubator-hawq git commit: HAWQ-92. Add a copy function for SegFileSplitMapNode

Repository: incubator-hawq
Updated Branches:
  refs/heads/master fc05875e0 -> ef3bf6a78


HAWQ-92. Add a copy function for SegFileSplitMapNode


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

Branch: refs/heads/master
Commit: ef3bf6a7847f12cf6a11caca21dc844271090a74
Parents: fc05875
Author: Lirong Jian <ji...@gmail.com>
Authored: Wed Oct 28 15:38:45 2015 +0800
Committer: Lirong Jian <ji...@gmail.com>
Committed: Wed Oct 28 15:38:45 2015 +0800

----------------------------------------------------------------------
 src/backend/nodes/copyfuncs.c     | 33 ++++++++++++++++++++++++++++++++-
 src/backend/utils/adt/lockfuncs.c |  2 ++
 2 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/ef3bf6a7/src/backend/nodes/copyfuncs.c
----------------------------------------------------------------------
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index a179d41..d9170ec 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -24,6 +24,7 @@
 #include "postgres.h"
 
 #include "access/attnum.h"
+#include "access/filesplit.h"
 #include "catalog/caqlparse.h"
 #include "catalog/gp_policy.h"
 #include "nodes/plannodes.h"
@@ -174,7 +175,7 @@ _copyPlannedStmt(PlannedStmt *from)
 	COPY_NODE_FIELD(result_partitions);
 	COPY_NODE_FIELD(result_aosegnos);
 	COPY_NODE_FIELD(result_segfileinfos);
-	COPY_SCALAR_FIELD(scantable_splits);
+	COPY_NODE_FIELD(scantable_splits);
 	COPY_NODE_FIELD(into_aosegnos);
 	COPY_NODE_FIELD(queryPartOids);
 	COPY_NODE_FIELD(queryPartsMetadata);
@@ -4194,6 +4195,30 @@ _copyResultRelSegFileInfo(ResultRelSegFileInfo *from)
   return newnode;
 }
 
+static SegFileSplitMapNode *
+_copySegFileSplitMapNode(SegFileSplitMapNode *from)
+{
+  SegFileSplitMapNode *newnode = makeNode(SegFileSplitMapNode);
+
+  COPY_SCALAR_FIELD(relid);
+  COPY_NODE_FIELD(splits);
+
+  return newnode;
+}
+
+static FileSplitNode *
+_copyFileSplitNode(FileSplitNode *from)
+{
+  FileSplitNode *newnode = makeNode(FileSplitNode);
+
+  COPY_SCALAR_FIELD(segno);
+  COPY_SCALAR_FIELD(logiceof);
+  COPY_SCALAR_FIELD(offsets);
+  COPY_SCALAR_FIELD(lengths);
+
+  return newnode;
+}
+
 static CaQLSelect *
 _copyCaQLSelect(const CaQLSelect *from)
 {
@@ -5130,6 +5155,12 @@ copyObject(void *from)
 		case T_ResultRelSegFileInfo:
 		  retval = _copyResultRelSegFileInfo(from);
 		  break;
+		case T_SegFileSplitMapNode:
+		  retval = _copySegFileSplitMapNode(from);
+		  break;
+		case T_FileSplitNode:
+		  retval = _copyFileSplitNode(from);
+		  break;
 
 		case T_DenyLoginInterval:
 			retval = _copyDenyLoginInterval(from);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/ef3bf6a7/src/backend/utils/adt/lockfuncs.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index e73f9f7..e8368b2 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -128,6 +128,8 @@ pg_lock_status(PG_FUNCTION_ARGS)
 		mystatus->numSegLocks = 0;
 		mystatus->numsegresults = 0;
 		mystatus->segresults = NULL;
+
+		MemoryContextSwitchTo(oldcontext);
 	}
 
 	funcctx = SRF_PERCALL_SETUP();