MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _add_star_projections

Function _add_star_projections

src/ast/ast_rewrite_call_subquery.c:592–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590}
591
592static bool _add_star_projections
593(
594 cypher_astnode_t *node // node to add the projections to
595) {
596 cypher_astnode_type_t type = cypher_astnode_type(node);
597
598 cypher_astnode_t *query;
599 if(type == CYPHER_AST_STATEMENT) {
600 query = (cypher_astnode_t *)cypher_ast_statement_get_body(node);
601 } else {
602 // node is a call {} clause
603 ASSERT(type == CYPHER_AST_CALL_SUBQUERY);
604
605 query = cypher_ast_call_subquery_get_query(node);
606 }
607
608 bool rewritten = false;
609 uint nclauses = cypher_ast_query_nclauses(query);
610 for(uint i = 1; i < nclauses; i++) {
611 cypher_astnode_t *clause = (cypher_astnode_t *)
612 cypher_ast_query_get_clause(query, i);
613 if(cypher_astnode_type(clause) == CYPHER_AST_CALL_SUBQUERY) {
614 _add_star_projection(node, i);
615 rewritten = true;
616
617 // update `query` and `nclauses` to reflect the new query
618 query = type == CYPHER_AST_STATEMENT ?
619 (cypher_astnode_t *)cypher_ast_statement_get_body(node) :
620 cypher_ast_call_subquery_get_query(node);
621 i++;
622 nclauses++;
623 clause = (cypher_astnode_t *)cypher_ast_query_get_clause(query, i);
624
625 _add_star_projections(clause);
626 }
627 }
628
629 return rewritten;
630}
631
632// if the subquery will result in an eager and returning execution-plan
633// rewrites it to contain the projections needed:

Callers 1

AST_RewriteCallSubqueryFunction · 0.85

Calls 1

_add_star_projectionFunction · 0.85

Tested by

no test coverage detected