From fd84af95dd4ce9d492d14dda8668e413788e8fdc Mon Sep 17 00:00:00 2001 From: Japin Li Date: Mon, 22 Apr 2024 19:17:44 +0800 Subject: [PATCH] Remove the unnecessary return statements (#258) This commit also fixes some typos. --- .../backend/columnar/columnar_customscan.c | 4 ++-- .../backend/columnar/columnar_planner_hook.c | 19 ++++--------------- .../expected/columnar_aggregates_2.out | 4 ++-- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/columnar/src/backend/columnar/columnar_customscan.c b/columnar/src/backend/columnar/columnar_customscan.c index 7ab06a0..f8e88a0 100644 --- a/columnar/src/backend/columnar/columnar_customscan.c +++ b/columnar/src/backend/columnar/columnar_customscan.c @@ -859,7 +859,7 @@ ExprReferencesRelid(Expr *expr, Index relid) * i) AND_EXPR: * Take pushdownable args of AND expressions by ignoring the other args. * ii) OR_EXPR: - * Ignore the whole OR expression if we cannot exract a pushdownable Expr + * Ignore the whole OR expression if we cannot extract a pushdownable Expr * from one of its args. * iii) NOT_EXPR: * Simply ignore NOT expressions since we don't expect to see them before @@ -949,7 +949,7 @@ ExtractPushdownClause(PlannerInfo *root, RelOptInfo *rel, Node *node) ereport(ColumnarPlannerDebugLevel, (errmsg("columnar planner: cannot push down clause: " "none of the arguments were pushdownable, " - "due to the reason(s) given above "))); + "due to the reason(s) given above"))); return NULL; } else if (npushdownableArgs == 1) diff --git a/columnar/src/backend/columnar/columnar_planner_hook.c b/columnar/src/backend/columnar/columnar_planner_hook.c index 5da182e..ba3b402 100644 --- a/columnar/src/backend/columnar/columnar_planner_hook.c +++ b/columnar/src/backend/columnar/columnar_planner_hook.c @@ -96,7 +96,7 @@ static Node * AggRefArgsExpressionMutator(Node *node, void *context) { if (node == NULL) - return false; + return NULL; Node *previousNode = (Node *) context; @@ -108,16 +108,10 @@ AggRefArgsExpressionMutator(Node *node, void *context) HeapTuple operatorTuple; if (list_length(opExprNode->args) != 2) - { elog(ERROR, "Aggregation vectorizaion works only on two arguments."); - return false; - } if (CheckOpExprArgumentRules(opExprNode->args)) - { elog(ERROR, "Unsupported aggregate argument combination."); - return false; - } operatorTuple = SearchSysCache1(OPEROID, ObjectIdGetDatum(opExprNode->opno)); operatorForm = (Form_pg_operator) GETSTRUCT(operatorTuple); @@ -126,9 +120,7 @@ AggRefArgsExpressionMutator(Node *node, void *context) Oid vectorizedProcedureOid; if (!GetVectorizedProcedureOid(procedureOid, &vectorizedProcedureOid)) - { elog(ERROR, "Vectorized aggregate not found."); - } opExprNode->opfuncid = vectorizedProcedureOid; @@ -137,10 +129,7 @@ AggRefArgsExpressionMutator(Node *node, void *context) /* This should handle aggregates that have non var(column) as argument*/ if (previousNode != NULL && IsA(previousNode, TargetEntry) && !IsA(node, Var)) - { - elog(ERROR, "Vectorized Aggregates accepts accepts only valid column argument"); - return false; - } + elog(ERROR, "Vectorized Aggregates accept only valid column argument"); return expression_tree_mutator(node, AggRefArgsExpressionMutator, (void *) node); } @@ -149,7 +138,7 @@ static Node * ExpressionMutator(Node *node, void *context) { if (node == NULL) - return false; + return NULL; if (IsA(node, Aggref)) { @@ -402,4 +391,4 @@ void columnar_planner_init(void) columnar_register_aggregator_node(); #endif columnar_register_indexscan_node(); -} \ No newline at end of file +} diff --git a/columnar/src/test/regress/expected/columnar_aggregates_2.out b/columnar/src/test/regress/expected/columnar_aggregates_2.out index f8987ce..05c3d16 100644 --- a/columnar/src/test/regress/expected/columnar_aggregates_2.out +++ b/columnar/src/test/regress/expected/columnar_aggregates_2.out @@ -215,7 +215,7 @@ DETAIL: Unsupported aggregate argument combination. -- Vectorized Aggregates accepts only non-const values. EXPLAIN (verbose, costs off, timing off, summary off) SELECT COUNT(1) FROM t_mixed; DEBUG: Query can't be vectorized. Falling back to original execution. -DETAIL: Vectorized Aggregates accepts accepts only valid column argument +DETAIL: Vectorized Aggregates accept only valid column argument QUERY PLAN -------------------------------------------------------------------------- Aggregate @@ -242,7 +242,7 @@ EXPLAIN (verbose, costs off, timing off, summary off) SELECT COUNT(DISTINCT a) F -- Vectorized aggregate doesn't accept function as argument EXPLAIN (verbose, costs off, timing off, summary off) SELECT SUM(length(b::text)) FROM t_mixed; DEBUG: Query can't be vectorized. Falling back to original execution. -DETAIL: Vectorized Aggregates accepts accepts only valid column argument +DETAIL: Vectorized Aggregates accept only valid column argument QUERY PLAN ---------------------------------------------------- Aggregate