Skip to content

Commit

Permalink
Revert "WIP for varnullingrels issue (#47)" (#48)
Browse files Browse the repository at this point in the history
This reverts commit ba0ac76.
  • Loading branch information
muhammadshoaib committed Nov 1, 2023
1 parent 802e271 commit a658cae
Showing 1 changed file with 1 addition and 53 deletions.
54 changes: 1 addition & 53 deletions src/backend/parser/cypher_clause.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ static bool isa_special_VLE_case(cypher_path *path);

static ParseNamespaceItem *find_pnsi(cypher_parsestate *cpstate, char *varname);

static void markRelsAsNulledBy(ParseState *pstate, int n, int jindex);
/*
* transform a cypher_clause
*/
Expand Down Expand Up @@ -4463,8 +4462,6 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate,
Node *expr = NULL;
bool refs_var = false;
ParseNamespaceItem *pnsi = NULL;
int jindex;


/*
* If we have an edge name, get any potential variable or column
Expand Down Expand Up @@ -4665,10 +4662,6 @@ static Expr *transform_cypher_edge(cypher_parsestate *cpstate,
pnsi = addRangeTableEntry(pstate, label_range_var, alias,
label_range_var->inh, true);
Assert(pnsi != NULL);
if (pstate->parentParseState->p_lateral_active) {
jindex = list_length(pstate->p_rtable + 1);
markRelsAsNulledBy(pstate, pnsi->p_rtindex, jindex);
}

/*
* relation is visible (r.a in expression works) but attributes in the
Expand Down Expand Up @@ -4712,7 +4705,6 @@ static Expr *transform_cypher_node(cypher_parsestate *cpstate,
cypher_node *cn = NULL;
bool refs_var = false;
ParseNamespaceItem *pnsi;
int jindex;

/* if we have a node name, get any potential variable references */
if (node->name != NULL)
Expand Down Expand Up @@ -4906,13 +4898,8 @@ static Expr *transform_cypher_node(cypher_parsestate *cpstate,
pnsi = addRangeTableEntry(pstate, label_range_var, alias,
label_range_var->inh, true);



Assert(pnsi != NULL);
if (pstate->parentParseState->p_lateral_active) {
jindex = list_length(pstate->p_rtable + 1);
markRelsAsNulledBy(pstate, pnsi->p_rtindex, jindex);
}

/*
* relation is visible (r.a in expression works) but attributes in the
* relation are not visible (a in expression doesn't work)
Expand Down Expand Up @@ -6873,42 +6860,3 @@ ParseNamespaceItem *find_pnsi(cypher_parsestate *cpstate, char *varname)

return NULL;
}

static void
markRelsAsNulledBy(ParseState *pstate, int n, int jindex)
{
int varno;
ListCell *lc;
varno = n;

/* Note: we can't see FromExpr here */
/* if (IsA(n, RangeTblRef)) */
/* { */
/* varno = ((RangeTblRef *) n)->rtindex; */
/* } */
/* else if (IsA(n, JoinExpr)) */
/* { */
/* JoinExpr *j = (JoinExpr *) n; */

/* /\* recurse to children *\/ */
/* markRelsAsNulledBy(pstate, j->larg, jindex); */
/* markRelsAsNulledBy(pstate, j->rarg, jindex); */
/* varno = j->rtindex; */
/* } */
/* else */
/* { */
/* elog(ERROR, "unrecognized node type: %d", (int) nodeTag(n)); */
/* varno = 0; /\* keep compiler quiet *\/ */
/* } */

/*
* Now add jindex to the p_nullingrels set for relation varno. Since we
* maintain the p_nullingrels list lazily, we might need to extend it to
* make the varno'th entry exist.
*/
while (list_length(pstate->p_nullingrels) < varno)
pstate->p_nullingrels = lappend(pstate->p_nullingrels, NULL);
lc = list_nth_cell(pstate->p_nullingrels, varno - 1);
lfirst(lc) = bms_add_member((Bitmapset *) lfirst(lc), jindex);
}

0 comments on commit a658cae

Please sign in to comment.