support IncrementalSortPath type in outNode()

Started by Hou, Zhijieabout 5 years ago2 messages
#1Hou, Zhijie
houzj.fnst@cn.fujitsu.com
1 attachment(s)

Hi,

I found IncrementalSortPath type is not analyzed in outNode.
It does not matter during runtime though.

Just for the convenience of debugging,
when debug by gdb, we can use "call pprint(incresortpath)" to list the node info.

So I try to support IncrementalSortPath in outNode.

Best regards,
houzj

Attachments:

0001-support-incremental-sort-in-outnode.patchapplication/octet-stream; name=0001-support-incremental-sort-in-outnode.patchDownload
From f71952891e41e8d1a65085910d3d488148dbaa9a Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Mon, 30 Nov 2020 04:14:12 -0500
Subject: [PATCH] support incremental sort in outnode()

---
 src/backend/nodes/outfuncs.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index bd5694d..82fafc3 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -1955,13 +1955,29 @@ _outProjectSetPath(StringInfo str, const ProjectSetPath *node)
 }
 
 static void
+_outSortPathInfo(StringInfo str, const SortPath *node)
+{
+	_outPathInfo(str, (const Path *) node);
+
+	WRITE_NODE_FIELD(subpath);
+}
+
+static void
 _outSortPath(StringInfo str, const SortPath *node)
 {
 	WRITE_NODE_TYPE("SORTPATH");
 
-	_outPathInfo(str, (const Path *) node);
+	_outSortPathInfo(str, node);
+}
 
-	WRITE_NODE_FIELD(subpath);
+static void
+_outIncrementalSortPath(StringInfo str, const IncrementalSortPath *node)
+{
+	WRITE_NODE_TYPE("INCREMENTALSORTPATH");
+
+	_outSortPathInfo(str, (const SortPath *) node);
+
+	WRITE_INT_FIELD(nPresortedCols);
 }
 
 static void
@@ -4055,6 +4071,9 @@ outNode(StringInfo str, const void *obj)
 			case T_SortPath:
 				_outSortPath(str, obj);
 				break;
+			case T_IncrementalSortPath:
+				_outIncrementalSortPath(str, obj);
+				break;
 			case T_GroupPath:
 				_outGroupPath(str, obj);
 				break;
-- 
1.8.3.1

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hou, Zhijie (#1)
Re: support IncrementalSortPath type in outNode()

"Hou, Zhijie" <houzj.fnst@cn.fujitsu.com> writes:

I found IncrementalSortPath type is not analyzed in outNode.

Indeed, that's supposed to be supported. Pushed, thanks for the patch!

regards, tom lane