Skip to content

Commit

Permalink
Run pgindent.
Browse files Browse the repository at this point in the history
Vaibhav Dalvi.
  • Loading branch information
jeevanchalke committed Dec 1, 2022
1 parent d3f0e6c commit bcb22ac
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
8 changes: 4 additions & 4 deletions deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ mongo_append_op_expr(OpExpr *node, BSON *child_doc, pipeline_cxt *context)
&expr);
else
bsonAppendStartObject(child_doc,
psprintf("%d", context->arrayIndex++),
&expr);
psprintf("%d", context->arrayIndex++),
&expr);
mongo_add_null_check(var, &expr, context);

if (context->isBoolExpr)
Expand Down Expand Up @@ -638,8 +638,8 @@ mongo_is_foreign_pathkey(PlannerInfo *root, RelOptInfo *baserel,
Expr *em_expr;

/*
* mongo_is_foreign_expr would detect volatile expressions as well,
* but checking ec_has_volatile here saves some cycles.
* mongo_is_foreign_expr would detect volatile expressions as well, but
* checking ec_has_volatile here saves some cycles.
*/
if (pathkey_ec->ec_has_volatile)
return false;
Expand Down
24 changes: 13 additions & 11 deletions mongo_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,11 @@ mongoGetForeignRelSize(PlannerInfo *root,
fpinfo->options = options;

#ifdef META_DRIVER

/*
* Store aggregation enable/disable option in the fpinfo directly for
* further use. This flag can be useful when options are not accessible in
* the recursive cases.
* further use. This flag can be useful when options are not accessible
* in the recursive cases.
*/
fpinfo->is_agg_scanrel_pushable = options->enable_aggregate_pushdown;
#endif
Expand Down Expand Up @@ -650,7 +651,7 @@ mongoGetForeignPlan(PlannerInfo *root,
bool has_final_sort = false;
bool has_limit = false;
int64 limit_value;
int64 offset_value;
int64 offset_value;

/*
* Get FDW private data created by mongoGetForeignUpperPaths(), if any.
Expand Down Expand Up @@ -859,6 +860,7 @@ mongoGetForeignPlan(PlannerInfo *root,
mongofdwreltype = BASE_REL;

#ifdef META_DRIVER

/*
* We use MongoRelQualInfo to pass various information related to joining
* quals and grouping target to fdw_private which is used to form
Expand Down Expand Up @@ -4520,8 +4522,8 @@ mongo_add_foreign_final_paths(PlannerInfo *root, RelOptInfo *input_rel,

/*
* We do not support LIMIT with FOR UPDATE/SHARE. Also, if there is no
* FOR UPDATE/SHARE clause and there is no LIMIT, don't need to add Foreign
* final path.
* FOR UPDATE/SHARE clause and there is no LIMIT, don't need to add
* Foreign final path.
*/
if (parse->rowMarks || !extra->limit_needed)
return;
Expand Down Expand Up @@ -4668,7 +4670,7 @@ mongo_add_foreign_final_paths(PlannerInfo *root, RelOptInfo *input_rel,

if (!((Const *) node)->constisnull &&
(DatumGetInt64(((Const *) node)->constvalue) < 0))
return;
return;
}
if (parse->limitOffset)
{
Expand All @@ -4680,7 +4682,7 @@ mongo_add_foreign_final_paths(PlannerInfo *root, RelOptInfo *input_rel,

if (!((Const *) node)->constisnull &&
(DatumGetInt64(((Const *) node)->constvalue) < 0))
return;
return;
}

/* Safe to push down */
Expand Down Expand Up @@ -4810,21 +4812,21 @@ mongo_is_default_sort_operator(EquivalenceMember *em, PathKey *pathkey)
pathkey->pk_strategy);
if (!OidIsValid(oprid))
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
pathkey->pk_strategy, em->em_datatype, em->em_datatype,
pathkey->pk_opfamily);
pathkey->pk_strategy, em->em_datatype, em->em_datatype,
pathkey->pk_opfamily);

/* Can't push down the sort if the operator is not shippable. */
oprname = get_opname(oprid);
if (!((strncmp(oprname, "<", NAMEDATALEN) == 0) ||
(strncmp(oprname, ">", NAMEDATALEN) == 0)))
(strncmp(oprname, ">", NAMEDATALEN) == 0)))
return false;

/*
* See whether the operator is default < or > for sort expr's datatype.
* Here we need to use the expression's actual type to discover whether
* the desired operator will be the default or not.
*/
typentry = lookup_type_cache(exprType((Node *)em->em_expr),
typentry = lookup_type_cache(exprType((Node *) em->em_expr),
TYPECACHE_LT_OPR | TYPECACHE_GT_OPR);
if (oprid == typentry->lt_opr || oprid == typentry->gt_opr)
return true;
Expand Down
15 changes: 8 additions & 7 deletions mongo_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static List *prepare_var_list_for_baserel(Oid relid, Index varno,
static HTAB *column_info_hash(List *colname_list, List *colnum_list,
List *rti_list, List *isouter_list);
static void mongo_prepare_pipeline(List *clause, BSON *inner_pipeline,
pipeline_cxt *context);
pipeline_cxt *context);
static void mongo_append_clauses_to_pipeline(List *clause, BSON *child_doc,
pipeline_cxt *context);
#endif
Expand Down Expand Up @@ -772,14 +772,14 @@ mongo_query_document(ForeignScanState *scanStateNode)
}
}
bsonAppendFinishObject(&sort_stage, &sort);
bsonAppendFinishObject(&root_pipeline, &sort_stage); /* End sort */
bsonAppendFinishObject(&root_pipeline, &sort_stage); /* End sort */
}

/* Add LIMIT/SKIP stage */
if (has_limit)
{
int64 limit_value;
int64 offset_value;
int64 offset_value;

/*
* Add skip stage for OFFSET clause. However, don't add the same if
Expand Down Expand Up @@ -1422,6 +1422,7 @@ foreign_expr_walker(Node *node, foreign_glob_cxt *glob_cxt,
/* Increment the Var count */
glob_cxt->varcount++;
#endif

/*
* If the Var is from the foreign table, we consider its
* collation (if any) safe to use. If it is from another
Expand Down Expand Up @@ -1521,15 +1522,15 @@ foreign_expr_walker(Node *node, foreign_glob_cxt *glob_cxt,
/*
* Recurse to input subexpressions.
*
* We support same operators as joinclause for WHERE conditions
* of simple as well as join relation.
* We support same operators as joinclause for WHERE
* conditions of simple as well as join relation.
*/
if (!foreign_expr_walker((Node *) oe->args, glob_cxt,
&inner_cxt)
#ifndef META_DRIVER
|| (glob_cxt->opexprcount > 1)
#endif
)
)
return false;

/*
Expand Down Expand Up @@ -1602,7 +1603,7 @@ foreign_expr_walker(Node *node, foreign_glob_cxt *glob_cxt,
#ifndef META_DRIVER
|| (glob_cxt->varcount > 1)
#endif
)
)
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions mongo_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ typedef struct pipeline_cxt
unsigned int arrayIndex; /* Index of the various arrays in the
* pipeline, starting from zero */
bool isBoolExpr; /* is join expression boolean? */
bool isJoinClause; /* is join clause? This is to add null check
only in case of join clause */
uint32 opExprCount; /* count death of the expression */
ForeignScanState *scanStateNode; /* To evaluate param expression */
bool isJoinClause; /* is join clause? This is to add null check
* only in case of join clause */
uint32 opExprCount; /* count death of the expression */
ForeignScanState *scanStateNode; /* To evaluate param expression */
} pipeline_cxt;

/*
Expand Down

0 comments on commit bcb22ac

Please sign in to comment.