This is an automated email from the ASF dual-hosted git repository.
dehowef pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-age.git
The following commit(s) were added to refs/heads/master by this push:
new 8aec335 Add CALL [YIELD] grammar rules
8aec335 is described below
commit 8aec335f242876187e8776c5df052376fd83ce39
Author: Dehowe Feng <[email protected]>
AuthorDate: Wed May 4 17:20:37 2022 -0700
Add CALL [YIELD] grammar rules
Add call ...[yield] grammar rules for the implementation of
CALL procedures.
---
src/backend/parser/cypher_gram.y | 49 +++++++++++++++++++++++++++++++++++-
src/backend/parser/cypher_keywords.c | 4 ++-
2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/src/backend/parser/cypher_gram.y b/src/backend/parser/cypher_gram.y
index 906cd6e..bd86911 100644
--- a/src/backend/parser/cypher_gram.y
+++ b/src/backend/parser/cypher_gram.y
@@ -79,7 +79,7 @@
/* keywords in alphabetical order */
%token <keyword> ALL ANALYZE AND AS ASC ASCENDING
BY
- CASE COALESCE CONTAINS CREATE
+ CALL CASE COALESCE CONTAINS CREATE
DELETE DESC DESCENDING DETACH DISTINCT
ELSE END_P ENDS EXISTS EXPLAIN
FALSE_P
@@ -95,6 +95,7 @@
VERBOSE
WHEN WHERE WITH
XOR
+ YIELD
/* query */
%type <node> stmt
@@ -130,6 +131,10 @@
/* MERGE clause */
%type <node> merge
+/* CALL ... YIELD clause */
+%type <node> call_stmt yield_item
+%type <list> yield_item_list
+
/* common */
%type <node> where_opt
@@ -317,6 +322,45 @@ cypher_stmt:
}
;
+call_stmt:
+ CALL expr_func_norm
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("CALL not supported yet"),
+ ag_scanner_errposition(@1, scanner)));
+ }
+ | CALL expr_func_norm YIELD yield_item_list where_opt
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("CALL... [YIELD] not supported yet"),
+ ag_scanner_errposition(@1, scanner)));
+ }
+ ;
+
+yield_item_list:
+ yield_item
+ {
+ $$ = list_make1($1);
+ }
+ | yield_item_list ',' yield_item
+ {
+ $$ = lappend($1, $3);
+ }
+ ;
+
+yield_item:
+ expr AS var_name
+ {
+
+ }
+ | expr
+ {
+
+ }
+ ;
+
semicolon_opt:
/* empty */
| ';'
@@ -412,6 +456,7 @@ updating_clause:
| remove
| delete
| merge
+ | call_stmt
;
cypher_varlen_opt:
@@ -1865,6 +1910,7 @@ safe_keywords:
| ASC { $$ = pnstrdup($1, 3); }
| ASCENDING { $$ = pnstrdup($1, 9); }
| BY { $$ = pnstrdup($1, 2); }
+ | CALL { $$ = pnstrdup($1, 4); }
| CASE { $$ = pnstrdup($1, 4); }
| COALESCE { $$ = pnstrdup($1, 8); }
| CONTAINS { $$ = pnstrdup($1, 8); }
@@ -1899,6 +1945,7 @@ safe_keywords:
| WHERE { $$ = pnstrdup($1, 5); }
| WITH { $$ = pnstrdup($1, 4); }
| XOR { $$ = pnstrdup($1, 3); }
+ | YIELD { $$ = pnstrdup($1, 5); }
;
conflicted_keywords:
diff --git a/src/backend/parser/cypher_keywords.c
b/src/backend/parser/cypher_keywords.c
index 63e2fb0..5ed1202 100644
--- a/src/backend/parser/cypher_keywords.c
+++ b/src/backend/parser/cypher_keywords.c
@@ -46,6 +46,7 @@ const ScanKeyword cypher_keywords[] = {
{"asc", ASC, RESERVED_KEYWORD},
{"ascending", ASCENDING, RESERVED_KEYWORD},
{"by", BY, RESERVED_KEYWORD},
+ {"call", CALL, RESERVED_KEYWORD},
{"case", CASE, RESERVED_KEYWORD},
{"coalesce", COALESCE, RESERVED_KEYWORD},
{"contains", CONTAINS, RESERVED_KEYWORD},
@@ -84,7 +85,8 @@ const ScanKeyword cypher_keywords[] = {
{"when", WHEN, RESERVED_KEYWORD},
{"where", WHERE, RESERVED_KEYWORD},
{"with", WITH, RESERVED_KEYWORD},
- {"xor", XOR, RESERVED_KEYWORD}
+ {"xor", XOR, RESERVED_KEYWORD},
+ {"yield", YIELD, RESERVED_KEYWORD}
};
const int num_cypher_keywords = lengthof(cypher_keywords);