Push down window functions more liberally if the table doesn't have a dist key

push-down-window-functs
Onur Tirtir 2023-04-05 14:40:59 +03:00
parent e5e5eb35c7
commit 37220a93f3
1 changed files with 2 additions and 26 deletions

View File

@ -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;
}