Skip to content

Commit

Permalink
Remove the unnecessary return statements (#258)
Browse files Browse the repository at this point in the history
This commit also fixes some typos.
  • Loading branch information
japinli authored Apr 22, 2024
1 parent fdbc04d commit fd84af9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
4 changes: 2 additions & 2 deletions columnar/src/backend/columnar/columnar_customscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
19 changes: 4 additions & 15 deletions columnar/src/backend/columnar/columnar_planner_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static Node *
AggRefArgsExpressionMutator(Node *node, void *context)
{
if (node == NULL)
return false;
return NULL;

Node *previousNode = (Node *) context;

Expand All @@ -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);
Expand All @@ -126,9 +120,7 @@ AggRefArgsExpressionMutator(Node *node, void *context)

Oid vectorizedProcedureOid;
if (!GetVectorizedProcedureOid(procedureOid, &vectorizedProcedureOid))
{
elog(ERROR, "Vectorized aggregate not found.");
}

opExprNode->opfuncid = vectorizedProcedureOid;

Expand All @@ -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);
}
Expand All @@ -149,7 +138,7 @@ static Node *
ExpressionMutator(Node *node, void *context)
{
if (node == NULL)
return false;
return NULL;

if (IsA(node, Aggref))
{
Expand Down Expand Up @@ -402,4 +391,4 @@ void columnar_planner_init(void)
columnar_register_aggregator_node();
#endif
columnar_register_indexscan_node();
}
}
4 changes: 2 additions & 2 deletions columnar/src/test/regress/expected/columnar_aggregates_2.out
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fd84af9

Please sign in to comment.