You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "mingfang (via GitHub)" <gi...@apache.org> on 2024/03/16 07:18:50 UTC

[I] MERGE incorrectly creates multiple vertices [age]

mingfang opened a new issue, #1691:
URL: https://github.com/apache/age/issues/1691

   ```sql
   SELECT * FROM cypher('playground', $$
   unwind ["foo", "foo"] as each
   merge (v:TEST {name: each})
   return v
   $$) AS (v agtype)
   ```
   returns
   ```json
   [
     {
       "v": {
         "id": 3659174697238531,
         "label": "TEST",
         "properties": {
           "name": "foo"
         }
       }
     },
     {
       "v": {
         "id": 3659174697238532,
         "label": "TEST",
         "properties": {
           "name": "foo"
         }
       }
     }
   ]
   ```
   creates two vertices when it should only create one. (confirmed with neo4j)
   


-- 
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-unsubscribe@age.apache.org.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2004725143

   @mingfang I stand corrected. It seems odd, though, that properties would be unique in this sense. We will likely need to adjust the contains versus equals operator for this case.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "mingfang (via GitHub)" <gi...@apache.org>.
mingfang closed issue #1691: MERGE incorrectly creates multiple vertices
URL: https://github.com/apache/age/issues/1691


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "mingfang (via GitHub)" <gi...@apache.org>.
mingfang commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2004655129

   @jrgemignani please note in my test case the problem is that there MERGE created two vertices with the same name, and not one vertex and one edge.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2028143137

   @mingfang Update: I currently have a fix for this and am reviewing it, creating test cases, and cleaning up the code. If all goes well, a PR should be available Monday or Tuesday.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2004649895

   @mingfang This is expected behavior. The key `name` is a property of a vertex, in this case. Vertices and edges are allowed to have the same properties.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "mingfang (via GitHub)" <gi...@apache.org>.
mingfang commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2013202968

   @jrgemignani 
   Thanks for the update.  
   I appreciate all your hard work.
   Thanks!


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2013170834

   @mingfang The particular cause for this issue is hard to easily describe, especially without getting very technical. Suffice to say, that MERGE (within the execution of a MERGE command instance) can't see what it has just created. 
   
   In most cases, this isn't an issue because MERGE only CREATEs what isn't already there. However, when it is driven externally, it is possible for it to have duplicates for duplicated data. I'm not sure if this is the only case where this is possible, though.
   
   I am looking into how to allow MERGE to know prior to inserting a duplicate **and** if this can resolve the issue. This may take some time, though, to implement.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "mingfang (via GitHub)" <gi...@apache.org>.
mingfang commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2004732935

   Also this is only a problem when multiple MERGE are called in the same query.
   e.g. this works as expected, only one vertex is created
   ```
   SELECT * FROM cypher('playground', $$
   unwind ["foo"] as each
   merge (v:TEST {name: each})
   return v
   $$) AS (v agtype)
   
   SELECT * FROM cypher('playground', $$
   unwind ["foo"] as each
   merge (v:TEST {name: each})
   return v
   $$) AS (v agtype)
   ```
   I'm guessing if multiple MERGE in the same query somehow is not seeing each statement's "state" since the transaction is not committed yet.  Totally a wild guess.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2004696804

   @mingfang Yes. I was just stating that this is also the case for edges. Vertices can have duplicate properties and edges can have duplicate properties. Properties are not unique.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2010464674

   @mingfang This is an interesting one.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "mingfang (via GitHub)" <gi...@apache.org>.
mingfang commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2004705333

   I'm sorry but I don't think that's correct.
   I've tested this in neo4j and it only results in one vertex created, not two like in AGE.
   Here is the neo4j doc that speaks directly to this
   https://neo4j.com/docs/cypher-manual/current/clauses/merge/#merge-merge-single-node-specifying-both-label-and-property
   `Merging a single node with both label and property matching an existing node will not create a new node:`


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2030768325

   @mingfang PR #1718 should address this issue once it is reviewed and merged.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "mingfang (via GitHub)" <gi...@apache.org>.
mingfang commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2030778828

   @jrgemignani Amazing. Thanks again!


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2004738633

   Yeah, the more that I look at it, the more it appears to fall there. Transaction bugs, though, can be a pain to fix. Especially, for merge.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "mingfang (via GitHub)" <gi...@apache.org>.
mingfang commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2001889209

   maybe same as https://github.com/apache/age/issues/1446


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2033277137

   @mingfang This should be fixed in the master branch now. If you could verify it, and close the ticket provided it resolves the issue,  that would be great.


-- 
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-unsubscribe@age.apache.org

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


Re: [I] MERGE incorrectly creates multiple vertices [age]

Posted by "mingfang (via GitHub)" <gi...@apache.org>.
mingfang commented on issue #1691:
URL: https://github.com/apache/age/issues/1691#issuecomment-2033504774

   @jrgemignani 
   confirm fixed. Thank you!


-- 
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-unsubscribe@age.apache.org

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