Skip to content

Commit

Permalink
renamed trunc_numeric_result_hook to adjust_numeric_result_hook
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Bhagat <rohitbgt@amazon.com>
  • Loading branch information
Rohit Bhagat committed Mar 9, 2025
1 parent b10e7bb commit 119177b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/backend/executor/execExprInterp.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
#if defined(EEO_USE_COMPUTED_GOTO)

/* Hook to truncate result to correct scale, when resulttype is numeric */
trunc_numeric_result_hook_type trunc_numeric_result_hook = NULL;
adjust_numeric_result_hook_type adjust_numeric_result_hook = NULL;

/* struct for jump target -> opcode lookup table */
typedef struct ExprEvalOpLookup
Expand Down Expand Up @@ -744,8 +744,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
*op->resvalue = d;
*op->resnull = fcinfo->isnull;

if (trunc_numeric_result_hook && fcinfo->flinfo != NULL)
*op->resvalue = trunc_numeric_result_hook(NULL, fcinfo->flinfo->fn_expr, d, *op->resnull, InvalidOid, -1);
if (adjust_numeric_result_hook && fcinfo->flinfo != NULL)
*op->resvalue = adjust_numeric_result_hook(NULL, fcinfo->flinfo->fn_expr, d, *op->resnull, InvalidOid, -1);

EEO_NEXT();
}
Expand All @@ -771,8 +771,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
*op->resvalue = d;
*op->resnull = fcinfo->isnull;

if (trunc_numeric_result_hook && fcinfo->flinfo != NULL)
*op->resvalue = trunc_numeric_result_hook(NULL, fcinfo->flinfo->fn_expr, d, *op->resnull, InvalidOid, -1);
if (adjust_numeric_result_hook && fcinfo->flinfo != NULL)
*op->resvalue = adjust_numeric_result_hook(NULL, fcinfo->flinfo->fn_expr, d, *op->resnull, InvalidOid, -1);

strictfail:
EEO_NEXT();
Expand Down
4 changes: 2 additions & 2 deletions src/backend/executor/nodeAgg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,10 +1118,10 @@ finalize_aggregate(AggState *aggstate,

result = FunctionCallInvoke(fcinfo);
*resultIsNull = fcinfo->isnull;
if (trunc_numeric_result_hook)
if (adjust_numeric_result_hook)
{
if (peragg->aggref != NULL)
result = trunc_numeric_result_hook(aggstate->ss.ps.plan,
result = adjust_numeric_result_hook(aggstate->ss.ps.plan,
(Node *) peragg->aggref,
result,
*resultIsNull,
Expand Down
4 changes: 2 additions & 2 deletions src/backend/optimizer/util/clauses.c
Original file line number Diff line number Diff line change
Expand Up @@ -5140,8 +5140,8 @@ evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod,
/* Release all the junk we just created */
FreeExecutorState(estate);

if (trunc_numeric_result_hook)
const_val = trunc_numeric_result_hook(NULL, NULL, const_val, const_is_null, result_type, result_typmod);
if (adjust_numeric_result_hook)
const_val = adjust_numeric_result_hook(NULL, expr, const_val, const_is_null, result_type, result_typmod);

/*
* Make the constant result node.
Expand Down
4 changes: 2 additions & 2 deletions src/include/executor/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ extern PGDLLEXPORT TriggerRecuresiveCheck_hook_type TriggerRecuresiveCheck_hook;
typedef bool (*bbfViewHasInsteadofTrigger_hook_type) (Relation view, CmdType event);
extern PGDLLIMPORT bbfViewHasInsteadofTrigger_hook_type bbfViewHasInsteadofTrigger_hook;

typedef Datum (*trunc_numeric_result_hook_type) (Plan *plan, Node *expr, Datum result, bool result_isnull, Oid result_type, int32 result_typmod);
extern PGDLLIMPORT trunc_numeric_result_hook_type trunc_numeric_result_hook;
typedef Datum (*adjust_numeric_result_hook_type) (Plan *plan, Node *expr, Datum result, bool result_isnull, Oid result_type, int32 result_typmod);
extern PGDLLIMPORT adjust_numeric_result_hook_type adjust_numeric_result_hook;

typedef void (*ExecUpdateResultTypeTL_hook_type) (PlanState *planstate, TupleDesc desc);
extern PGDLLIMPORT ExecUpdateResultTypeTL_hook_type ExecUpdateResultTypeTL_hook;
Expand Down

0 comments on commit 119177b

Please sign in to comment.