docs: clarify CALL UNION variable scope (#3317)

AG
2d ago
+26-0

Summary

Clarifies the visibility of imported variables across UNION and UNION ALL branches within FalkorDB CALL {} subqueries.

Problem

The existing documentation explains importing variables using an opening WITH clause but does not explicitly describe whether those variables remain accessible across subsequent UNION branches.

Issue: FalkorDB/FalkorDB#3317

Changes

  • Added a dedicated section explaining variable scope across UNION branches.
  • Included a reproducible query demonstrating the 'n' not defined error.
  • Documented behavior observed in FalkorDB 4.20.7 and 6.0.2.
  • Linked the original issue for additional context.

Verification

  • Reviewed the documentation rendering.
  • Used the reproduction results recorded in Issue #3317.
  • No independent database execution was performed for this documentation-only change.

Scope

Documentation-only clarification. No query engine modifications.

Related to FalkorDB/FalkorDB#3317.


Summary by cubic

Clarifies in the Cypher docs that, in CALL {} subqueries using UNION or UNION ALL, an opening WITH import in the first branch does not make those variables available in later branches for FalkorDB 4.20.7 and 6.0.2.

  • Adds a reproducible example showing the 'n' not defined error and guidance to import variables in each branch instead.
  • Links to FalkorDB/FalkorDB#3317 for the documented test results.

Summary by CodeRabbit

  • Documentation
    • Clarified that an opening WITH in the first CALL branch does not make its variable available in later UNION branches in FalkorDB 4.20.7 and 6.0.2.
    • Added an example of the resulting undefined-variable error and guidance to account for imports in each branch.