提交 5c9b81ef 编写于 作者: K Kavinder Dhaliwal

Remove function isMemoryIntensiveFunction

Historically this function was used to special case a few operators that
were not considered to be MemoryIntensive. However, now it always
returns true. This commit removes the function and also moves the case
for T_FunctionScan in IsMemoryIntensiveOperator into the group that
always returns true, as this is its current behavior
上级 8a31b037
......@@ -206,24 +206,8 @@ IsBlockingOperator(Node *node)
}
}
/**
* Special-case certain functions which we know are not memory intensive.
* TODO caragg 03/04/2014: Revert these changes when ORCA has the new partition
* operator (MPP-22799)
*
*/
static bool
isMemoryIntensiveFunction(Oid funcid)
{
return true;
}
/**
* Is a result node memory intensive? It is if it contains function calls.
* We special-case certain functions used by ORCA which we know that are not
* memory intensive
* TODO caragg 03/04/2014: Revert these changes when ORCA has the new partition
* operator (MPP-22799)
*/
bool
IsResultMemoryIntesive(Result *res)
......@@ -233,59 +217,20 @@ IsResultMemoryIntesive(Result *res)
(Node *) ((Plan *) res)->targetlist, T_FuncExpr);
int nFuncExpr = list_length(funcNodes);
/* Shallow free of the funcNodes list */
list_free(funcNodes);
funcNodes = NIL;
if (nFuncExpr == 0)
{
/* No function expressions, not memory intensive */
return false;
}
bool isMemoryIntensive = false;
ListCell *lc = NULL;
foreach(lc, funcNodes)
{
FuncExpr *funcExpr = lfirst(lc);
Assert(IsA(funcExpr, FuncExpr));
if ( isMemoryIntensiveFunction(funcExpr->funcid))
{
/* Found a function that we don't know of. Mark as memory intensive */
isMemoryIntensive = true;
break;
}
}
/* Shallow free of the funcNodes list */
list_free(funcNodes);
funcNodes = NIL;
return isMemoryIntensive;
}
/**
* Is a function scan memory intensive? Special case some known functions
* that are not memory intensive.
*/
static bool
IsFunctionScanMemoryIntensive(FunctionScan *funcScan, PlannedStmt *stmt)
{
Assert(NULL != stmt);
Assert(NULL != funcScan);
Index rteIndex = funcScan->scan.scanrelid;
RangeTblEntry *rte = rt_fetch(rteIndex, stmt->rtable);
Assert(RTE_FUNCTION == rte->rtekind);
if (IsA(rte->funcexpr, FuncExpr))
else
{
FuncExpr *funcExpr = (FuncExpr *) rte->funcexpr;
return isMemoryIntensiveFunction(funcExpr->funcid);
return true;
}
/* Didn't find any of our special cases, default is memory intensive */
return true;
}
/**
* Is an operator memory intensive?
*/
......@@ -302,6 +247,7 @@ IsMemoryIntensiveOperator(Node *node, PlannedStmt *stmt)
case T_BitmapIndexScan:
case T_Window:
case T_TableFunctionScan:
case T_FunctionScan:
return true;
case T_Agg:
{
......@@ -313,11 +259,6 @@ IsMemoryIntensiveOperator(Node *node, PlannedStmt *stmt)
Result *res = (Result *) node;
return IsResultMemoryIntesive(res);
}
case T_FunctionScan:
{
FunctionScan *funcScan = (FunctionScan *) node;
return IsFunctionScanMemoryIntensive(funcScan, stmt);
}
default:
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册