提交 e1fd6072 编写于 作者: N Nikos Armenatzoglou 提交者: Karen Huddleston

Abort code generation of expression evaluation trees with unsupported ExprState types

Current codegen expression evaluation framework generates code based only on
ExprState->Expr->type (e.g., T_Var), without checking the ExprState->type.
In other words, it treats all nodes of the tree that have the same type
(e.g., T_Var) in the same way (i.e., generates the same code).

However, in GPDB the evaluation function (evalfunc) of a node depends
on ExprState->Expr->type and ExprState->type. For example, if
ExprState->Expr->type = T_Var and ExprState->type = T_ExprState, then
the evalfunc  = ExecEvalScalarVar. On the other hand, if
ExprState->Expr->type = T_Var and ExprState->type =
T_WholeRowVarExprState, then evalfunc = ExecEvalWholeRowVar.

We fix this issue by avoiding code generation for an expression tree
that contains nodes of unsupported ExprState->type.
Signed-off-by: NKaren Huddleston <khuddleston@pivotal.io>
上级 b3ceb0a8
......@@ -33,6 +33,13 @@ bool ExprTreeGenerator::VerifyAndCreateExprTree(
assert(nullptr != expr_state &&
nullptr != expr_state->expr &&
nullptr != expr_tree);
if (!(IsA(expr_state, FuncExprState) ||
IsA(expr_state, ExprState)) ){
elog(DEBUG1, "Input expression state type (%d) is not supported",
expr_state->type);
return false;
}
expr_tree->reset(nullptr);
bool supported_expr_tree = false;
switch (nodeTag(expr_state->expr)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册