I assigned a value to the vertex property,I can print it successfully,but when this vertex property is used as input to a query,the query still calculate based on the previous vertex property
Just to confirm:
Are you updating the vertex property with one query, and then using that updated vertex in a subsequent query? Query 2 is definitely initiated after Query 1?
Can you post some snippets of your query, to make sure we understand correct what you are doing?
Thanks firstly!
I can give an example:in query 1, vertex property s.a = 0 initially, and then I update s.a=1 , and then I print s.a to examine, the outcome is that s.a=1. I invoke query 2 (who use s.a as an input) in query 1,the outcome of query 2 is the outcome that input s.a=0.
Thank you for your reply.
I see the problem:
You are invoking Query 2 inside of Query 1, so it is actually a subquery, not after Query 1.
In GSQL, the query execution engine puts update requests into a queue, and then processes them in bulk at the end of the query. A similar behavior takes place in ACCUM clauses: changes to accumulators only take place at the end of the ACCUM (or the end of a POST-ACCUM).
We have a NOTE and examples on the Data Modification documentation page:
**Modifications to the graph data do not take effect until the entire query is completed (committed)**. If one step needs to see the changes of an earlier step, you must separate the work into separate queries run in sequence.
We realize we could make it easier for users to be aware of this behavior. We will see how we can improve our documentation and training material.
Also, our feature backlog includes adding an option to have the updates take effect within a query.
Thanks again!
But in the case that I do not invoke query 2 in query 1, when I update s.a in query 1, I print s.a in query 2, it shows s.a =1, but the outcome of query2 is still the outcome whose input s.a =0.
This consequence is why?
Hello,
Assume below table is your vertex
The value of attribute “a” is updated to “1” in query1 (Note that the value is not yet committed ). But when query2 is called from query1 as subquery, it reads the value from vertex (refer to the value in table), where it is still “0”. If you call query1 and query2 sequentially instead of making query2 as subquery, you can see the updated value in query2.
If it is not clear, please provide a sample of query1 and query2, it will be easy to figure out.
I realize it! Thanks a lot!
But now I have two questions:
(1)In query 1. there is a iterative process(just 2 iteration).
For exmaple, in the first iteration, I update s.a=1; in the second iteration, I update s.a =2
In the first iteration,the updated value of s.a (s.a=1) is successfully used by called query 2, but in the second iteration, the value that is updated again (s.a=2) is not successfully used by query 2.
If the updated value of database data just take effect until the entire query is completed, why the first updated s.a can be used by query 2?
(2) After I run query 1, I run query 2 standalone, the outcome of query 2 shows that s.a = 1. And then, I run query 2 again, the outcome of query 2 shows that s.a =2. Why I run again, s.a is updated?
(3)If I call query 3 as a subquery of query 1 to update the value of s.a before calling query 2, can query 2 see the updated value of s.a ?
in this example, query 1 refers to a linear programming solvings code to get the unit output. And s.a refers to the node injection power (unit output minus load), query 2 refers to the powerflow calculate code.
Hello,
If you could provide sample query (query1, query2 & query3), I can help you if possible.