From 5f85c2a263d067a5e6a3fb6a1870049f3e25e482 Mon Sep 17 00:00:00 2001
From: Andy Fan <yizhi.fzh@alibaba-inc.com>
Date: Tue, 5 Apr 2022 14:58:11 +0800
Subject: [PATCH v1 2/3] not return "run condition" = false tuple to upper
 node.

---
 src/backend/executor/nodeWindowAgg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index f8792407773..ad592e9283a 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -2116,6 +2116,7 @@ ExecWindowAgg(PlanState *pstate)
 		/* we don't need to invalidate grouptail here; see below */
 	}
 
+retry:
 	/*
 	 * Spool all tuples up to and including the current row, if we haven't
 	 * already
@@ -2278,7 +2279,10 @@ ExecWindowAgg(PlanState *pstate)
 		 * use_pass_through field.
 		 */
 		if (winstate->use_pass_through)
+		{
 			winstate->status = WINDOWAGG_PASSTHROUGH;
+			goto retry;
+		}
 		else
 		{
 			winstate->status = WINDOWAGG_DONE;
-- 
2.21.0

