Skip to content

Commit e2a1e77

Browse files
committed
Strip out transform_entity logic
gone. was needed at one point, now it isn't should simplify everything in the parser
1 parent 4337463 commit e2a1e77

File tree

10 files changed

+6
-317
lines changed

10 files changed

+6
-317
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ OBJS = src/backend/postgraph.o \
4545
src/backend/parser/cypher_parse_agg.o \
4646
src/backend/parser/cypher_parse_node.o \
4747
src/backend/parser/cypher_parser.o \
48-
src/backend/parser/cypher_transform_entity.o \
4948
src/backend/utils/adt/gtype.o \
5049
src/backend/utils/adt/gtype_ext.o \
5150
src/backend/utils/adt/gtype_gin.o \

regress/sql/cypher_create.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ EXPLAIN ANALYZE MATCH (q)-[]->(q)-[]->() RETURN 1;
8686
MATCH (q)-[]->(q)-[]->() RETURN 1;
8787

8888

89-
9089
EXPLAIN ANALYZE
9190
MATCH (q)
9291
MATCH (q)-[]->()

src/backend/parser/cypher_analyze.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,6 @@ analyze_cypher(List *stmt, ParseState *parent_pstate, const char *query_str, int
13461346
cpstate->graph_oid = graph_oid;
13471347
cpstate->params = params;
13481348
cpstate->default_alias_num = 0;
1349-
cpstate->entities = NIL;
13501349

13511350
Query *query = transform_cypher_clause(cpstate, clause);
13521351

src/backend/parser/cypher_expr.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
#include "parser/cypher_expr.h"
5858
#include "parser/cypher_item.h"
5959
#include "parser/cypher_parse_node.h"
60-
#include "parser/cypher_transform_entity.h"
6160
#include "utils/ag_func.h"
6261
#include "utils/gtype.h"
6362
#include "utils/gtype_typecasting.h"
@@ -1953,7 +1952,7 @@ transform_column_ref(cypher_parsestate *cpstate, ColumnRef *cref) {
19531952
ParseNamespaceItem *pnsi;
19541953

19551954
if (list_length(cref->fields) == 1) {
1956-
transform_entity *te;
1955+
19571956
field1 = (Node*)linitial(cref->fields);
19581957

19591958
Assert(IsA(field1, String));
@@ -1963,11 +1962,7 @@ transform_column_ref(cypher_parsestate *cpstate, ColumnRef *cref) {
19631962
if (node != NULL)
19641963
return node;
19651964

1966-
te = find_variable(cpstate, colname) ;
1967-
if (te != NULL && te->expr != NULL) {
1968-
node = (Node *)te->expr;
1969-
return node;
1970-
} else {
1965+
{
19711966
ParseNamespaceItem *nsitem = refnameNamespaceItem(pstate, NULL, colname, cref->location, &levels_up);
19721967

19731968
if (nsitem) {
@@ -1988,18 +1983,15 @@ transform_column_ref(cypher_parsestate *cpstate, ColumnRef *cref) {
19881983
}
19891984

19901985
Node *last_srf = pstate->p_last_srf;
1991-
transform_entity *te;
1986+
19921987
field1 = (Node*)linitial(cref->fields);
19931988

19941989
Assert(IsA(field1, String));
19951990
colname = strVal(field1);
19961991

19971992
node = colNameToVar(pstate, colname, false, cref->location);
19981993
if (node == NULL){
1999-
te = find_variable(cpstate, colname) ;
2000-
if (te != NULL && te->expr != NULL) {
2001-
node = (Node *)te->expr;
2002-
} else {
1994+
20031995
ParseNamespaceItem *nsitem = refnameNamespaceItem(pstate, NULL, colname, cref->location, &levels_up);
20041996

20051997
if (nsitem) {
@@ -2009,7 +2001,7 @@ transform_column_ref(cypher_parsestate *cpstate, ColumnRef *cref) {
20092001
ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN),
20102002
errmsg("could not find rte for %s", colname),
20112003
parser_errposition(pstate, cref->location)));
2012-
}
2004+
20132005

20142006
}
20152007
if (!node)

src/backend/parser/cypher_grouping.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include "parser/cypher_item.h"
4242
#include "parser/cypher_parse_agg.h"
4343
#include "parser/cypher_parse_node.h"
44-
#include "parser/cypher_transform_entity.h"
4544
#include "utils/ag_cache.h"
4645
#include "utils/ag_func.h"
4746
#include "utils/gtype.h"

src/backend/parser/cypher_item.c

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "parser/cypher_item.h"
3939
#include "parser/cypher_parse_node.h"
4040

41-
static List *ExpandAllTables(ParseState *pstate, int location);
4241
static List *expand_rel_attrs(ParseState *pstate, RangeTblEntry *rte,
4342
int rtindex, int sublevels_up, int location);
4443

@@ -206,7 +205,7 @@ List *transform_cypher_item_list(cypher_parsestate *cpstate, List *item_list,
206205
/* clear the exprHasAgg flag to check transform for an aggregate */
207206
cpstate->exprHasAgg = false;
208207

209-
// if (item->name[0] == '_' && item->name[1] == '_')
208+
//if (item->name[0] == '_' && item->name[1] == '_')
210209
// continue;
211210
/* transform the item */
212211
te = transform_cypher_item(cpstate, item->val, NULL, expr_kind, item->name, false);
@@ -236,42 +235,6 @@ List *transform_cypher_item_list(cypher_parsestate *cpstate, List *item_list,
236235
return target_list;
237236
}
238237

239-
/*
240-
* From PG's ExpandAllTables()
241-
* Transforms '*' (in the target list) into a list of targetlist entries.
242-
*/
243-
static List *ExpandAllTables(ParseState *pstate, int location)
244-
{
245-
List *target = NIL;
246-
bool found_table = false;
247-
ListCell *l;
248-
249-
foreach(l, pstate->p_namespace)
250-
{
251-
ParseNamespaceItem *nsitem = (ParseNamespaceItem *) lfirst(l);
252-
253-
/* Ignore table-only items */
254-
if (!nsitem->p_cols_visible)
255-
continue;
256-
/* Should not have any lateral-only items when parsing targetlist */
257-
Assert(!nsitem->p_lateral_only);
258-
/* Remember we found a p_cols_visible item */
259-
found_table = true;
260-
261-
target = list_concat(target, expand_rel_attrs(pstate, nsitem->p_rte,
262-
nsitem->p_rtindex,
263-
0, location));
264-
}
265-
266-
/* Check for "RETURN *;" */
267-
if (!found_table)
268-
ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR),
269-
errmsg("RETURN * without a pattern is not valid"),
270-
parser_errposition(pstate, location)));
271-
272-
return target;
273-
}
274-
275238
/*
276239
* From PG's expandRelAttrs
277240
* Modified to exclude hidden variables and aliases in RETURN *

src/backend/parser/cypher_parse_node.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,14 @@ char *get_next_default_alias(cypher_parsestate *cpstate)
7878
char *alias_name;
7979
int nlen = 0;
8080

81-
/* get the length of the combinded string */
8281
nlen = snprintf(NULL, 0, "%s%d", AGE_DEFAULT_ALIAS_PREFIX,
8382
cpstate->default_alias_num);
8483

85-
/* allocate the space */
8684
alias_name = palloc0(nlen + 1);
8785

88-
/* create the name */
8986
snprintf(alias_name, nlen + 1, "%s%d", AGE_DEFAULT_ALIAS_PREFIX,
9087
cpstate->default_alias_num);
9188

92-
/* increment the default alias number */
9389
cpstate->default_alias_num++;
9490

9591
return alias_name;

src/backend/parser/cypher_transform_entity.c

Lines changed: 0 additions & 156 deletions
This file was deleted.

src/backend/utils/edge_searching.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,4 @@ Datum variable_edge_search(PG_FUNCTION_ARGS)
389389
}
390390
//destroyHashSetValue(cxt->hashSet);
391391
SRF_RETURN_DONE(funcctx);
392-
393-
394392
}

0 commit comments

Comments
 (0)