CapnSpek commented on issue #1219:
URL: https://github.com/apache/age/issues/1219#issuecomment-1739124705

   I am not very sure but can `transform_cypher_merge` function have something 
to do with it?
   
   The comments mention this, and the function is also hit during debugging.
   
   It is proving to be difficult to trace this bug because there seems to be no 
particular variable where I can check whether x is being passed or not, and no 
way to check what would be an SQL equivalent of the cypher query, specially 
when the query plan trees look fine.
   
   Can anyone suggest a way to track the source of this bug?
   
   ```
   \*
   * 2. If there is a previous clause then the query will have two subqueries.
    * The first query will be for the previous clause that we recursively 
handle.
    * The second query will be for the path that this MERGE clause defines. The
    * two subqueries will be joined together using a LATERAL LEFT JOIN with the
    * previous query on the left and the MERGE path subquery on the right. Like
    * case 1 the targetList will have all the declared variables and a FuncExpr
    * that represents the MERGE clause with its needed metadata information, 
that
    * will be caught in the planner phase and converted into a path.
    *
    * This will allow us to be capable of handling the 2 cases that exist with a
    * MERGE clause correctly.
    *
    * Case 1: the path already exists. In this case we do not need to create
    * the path and MERGE will simply pass the tuple information up the execution
    * tree.
    *
    * Case 2: the path does not exist. In this case the LEFT part of the join
    * will not prevent the tuples from the previous clause from being emitted. 
We
    * can catch when this happens in the execution phase and create the missing
    * data, before passing up the execution tree.
    *
    * It should be noted that both cases can happen in the same query. If the
    * MERGE clause references a variable from a previous clause, it could be 
that
    * for one tuple the path exists (or there is multiple paths that exist and 
all
    * paths must be emitted) and for another the path does not exist. This is
    * similar to OPTIONAL MATCH, however with the added feature of creating the
    * path if not there, rather than just emitting NULL.
    */
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@age.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to