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

Function _AST_MapMergeClauseReference

src/ast/ast_build_reference_map.c:384–411  ·  view source on GitHub ↗

Maps entities in MERGE clause. Either by implicit filters, or modified entities by SET clause.

Source from the content-addressed store, hash-verified

382
383// Maps entities in MERGE clause. Either by implicit filters, or modified entities by SET clause.
384static void _AST_MapMergeClauseReference(AST *ast, const cypher_astnode_t *merge_clause) {
385 // Collect implicitly filtered entities.
386 const cypher_astnode_t *merge_path = cypher_ast_merge_get_pattern_path(merge_clause);
387 bool force_mapping = _shouldForceMapping(merge_path);
388 _AST_MapReferencedEntitiesInPath(ast, merge_path, force_mapping);
389
390 // Map modified entities, either by ON MATCH or ON CREATE clause.
391 uint merge_actions = cypher_ast_merge_nactions(merge_clause);
392 for(uint i = 0; i < merge_actions; i++) {
393 const cypher_astnode_t *action = cypher_ast_merge_get_action(merge_clause, i);
394 cypher_astnode_type_t type = cypher_astnode_type(action);
395 // ON CREATE.
396 if(type == CYPHER_AST_ON_CREATE) {
397 uint on_create_items = cypher_ast_on_create_nitems(action);
398 for(uint j = 0; j < on_create_items; j ++) {
399 const cypher_astnode_t *set_item = cypher_ast_on_create_get_item(action, j);
400 _AST_MapSetItemReferences(ast, set_item);
401 }
402 } else if(type == CYPHER_AST_ON_MATCH) {
403 // ON MATCH.
404 uint on_match_items = cypher_ast_on_match_nitems(action);
405 for(uint j = 0; j < on_match_items; j ++) {
406 const cypher_astnode_t *set_item = cypher_ast_on_match_get_item(action, j);
407 _AST_MapSetItemReferences(ast, set_item);
408 }
409 }
410 }
411}
412
413// Map the LHS of "AS" projected entities. "WITH a as x order by x" will just collect a to the map.
414static void _AST_MapWithReferredEntities(AST *ast_segment, const cypher_astnode_t *with_clause) {

Callers 1

Calls 3

_shouldForceMappingFunction · 0.85

Tested by

no test coverage detected