提交 1b26fbfc 编写于 作者: N Nikos Armenatzoglou 提交者: Karthikeyan Jambu Rajaraman

Enrolled targetlist for scan and aggregate

Signed-off-by: NKarthikeyan Jambu Rajaraman <karthi.jrk@gmail.com>
上级 ebd1d014
......@@ -129,3 +129,5 @@ void* ExecEvalExprCodegenEnroll(
return generator;
}
......@@ -45,16 +45,16 @@ void OpExprTreeGenerator::InitializeSupportedFunction() {
int32_t, int32_t>(1088, "date_le", &IRBuilder<>::CreateICmpSLE));
supported_function_[177] = std::unique_ptr<PGFuncGeneratorInterface>(
new PGGenericFuncGenerator<int32_t, int32_t>(
141, "int4pl", &PGArithFuncGenerator<int32_t, int32_t, int32_t>::AddWithOverflow));
new PGGenericFuncGenerator<int32_t, int32_t>(
177, "int4pl", &PGArithFuncGenerator<int32_t, int32_t, int32_t>::AddWithOverflow));
supported_function_[181] = std::unique_ptr<PGFuncGeneratorInterface>(
new PGGenericFuncGenerator<int32_t, int32_t>(
141, "int4mi", &PGArithFuncGenerator<int32_t, int32_t, int32_t>::SubWithOverflow));
new PGGenericFuncGenerator<int32_t, int32_t>(
181, "int4mi", &PGArithFuncGenerator<int32_t, int32_t, int32_t>::SubWithOverflow));
supported_function_[141] = std::unique_ptr<PGFuncGeneratorInterface>(
new PGGenericFuncGenerator<int32_t, int32_t>(
141, "int4mul", &PGArithFuncGenerator<int32_t, int32_t, int32_t>::MulWithOverflow));
new PGGenericFuncGenerator<int32_t, int32_t>(
141, "int4mul", &PGArithFuncGenerator<int32_t, int32_t, int32_t>::MulWithOverflow));
}
OpExprTreeGenerator::OpExprTreeGenerator(
......
......@@ -162,6 +162,12 @@ static void ExecCdbTraceNode(PlanState *node, bool entry, TupleTableSlot *result
void *context,
int flags);
void
EnrollQualList(PlanState* result);
void
EnrollProjInfoTargetList(ProjectionInfo* ProjInfo);
/*
* setSubplanSliceId
* Set the slice id info for the given subplan.
......@@ -336,20 +342,17 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
{
result = (PlanState *) ExecInitTableScan((TableScan *) node,
estate, eflags);
}
END_MEMORY_ACCOUNT();
#ifdef USE_CODEGEN
/* Enroll quals' expression evaluation functions in codegen_manager */
if (result && NULL != result->qual)
/*
* Enroll targetlist & quals' expression evaluation functions
* in codegen_manager
*/
EnrollQualList(result);
if (NULL !=result)
{
ListCell *l;
foreach(l, result->qual)
{
ExprState *exprstate = (ExprState *) lfirst(l);
enroll_ExecEvalExpr_codegen(exprstate->evalfunc, &exprstate->evalfunc, exprstate, result->ps_ExprContext);
}
EnrollProjInfoTargetList(result->ps_ProjInfo);
}
#endif
}
END_MEMORY_ACCOUNT();
break;
case T_DynamicTableScan:
......@@ -573,6 +576,20 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
{
result = (PlanState *) ExecInitAgg((Agg *) node,
estate, eflags);
/*
* Enroll targetlist & quals' expression evaluation functions
* in codegen_manager
*/
EnrollQualList(result);
if (NULL != result)
{
AggState* aggstate = (AggState*)result;
for (int aggno = 0; aggno < aggstate->numaggs; aggno++)
{
AggStatePerAgg peraggstate = &aggstate->peragg[aggno];
EnrollProjInfoTargetList(peraggstate->evalproj);
}
}
}
END_MEMORY_ACCOUNT();
break;
......@@ -752,6 +769,61 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
return result;
}
/* ----------------------------------------------------------------
* EnrollTargetAndQualList
*
* Enroll Target and Qual List from PlanState to Codegen
* ----------------------------------------------------------------
*/
void
EnrollQualList(PlanState* result)
{
#ifdef USE_CODEGEN
if (NULL == result ||
NULL == result->qual)
{
return;
}
ListCell *l;
foreach(l, result->qual)
{
ExprState *exprstate = (ExprState*) lfirst(l);
enroll_ExecEvalExpr_codegen(exprstate->evalfunc,
&exprstate->evalfunc,
exprstate, result->ps_ExprContext);
}
#endif
}
void
EnrollProjInfoTargetList(ProjectionInfo* ProjInfo)
{
#ifdef USE_CODEGEN
if (NULL == ProjInfo ||
NULL == ProjInfo->pi_targetlist)
{
return;
}
ListCell *l;
foreach(l, ProjInfo->pi_targetlist)
{
GenericExprState *gstate = (GenericExprState *) lfirst(l);
if (NULL == gstate->arg ||
NULL == gstate->arg->evalfunc) {
continue;
}
enroll_ExecEvalExpr_codegen(gstate->arg->evalfunc,
&gstate->arg->evalfunc,
gstate->arg,
ProjInfo->pi_exprContext);
}
#endif
}
/* ----------------------------------------------------------------
* ExecSliceDependencyNode
*
......
......@@ -151,6 +151,7 @@ ExecEvalExprCodegenEnroll(ExecEvalExprFn regular_func_ptr,
struct ExprState *exprstate,
struct ExprContext *econtext);
#ifdef __cplusplus
} // extern "C"
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册