From 37220a93f3955ed0a1fad17e5915c949b32658a5 Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Wed, 5 Apr 2023 14:40:59 +0300 Subject: [PATCH] Push down window functions more liberally if the table doesn't have a dist key --- .../planner/query_pushdown_planning.c | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/src/backend/distributed/planner/query_pushdown_planning.c b/src/backend/distributed/planner/query_pushdown_planning.c index cbe6a3606..98b118a09 100644 --- a/src/backend/distributed/planner/query_pushdown_planning.c +++ b/src/backend/distributed/planner/query_pushdown_planning.c @@ -422,38 +422,14 @@ IsOuterJoinExpr(Node *node) bool SafeToPushdownWindowFunction(Query *query, StringInfo *errorDetail) { - ListCell *windowClauseCell = NULL; - List *windowClauseList = query->windowClause; - - /* - * We need to check each window clause separately if there is a partition by clause - * and if it is partitioned on the distribution column. - */ - foreach(windowClauseCell, windowClauseList) - { - WindowClause *windowClause = lfirst(windowClauseCell); - - if (!windowClause->partitionClause) - { - if (errorDetail) - { - *errorDetail = makeStringInfo(); - appendStringInfoString(*errorDetail, - "Window functions without PARTITION BY on distribution " - "column is currently unsupported"); - } - return false; - } - } - if (!WindowPartitionOnDistributionColumn(query)) { if (errorDetail) { *errorDetail = makeStringInfo(); appendStringInfoString(*errorDetail, - "Window functions with PARTITION BY list missing distribution " - "column is currently unsupported"); + "Window functions should have a PARTITION BY clause list " + "that contains distribution column"); } return false; }