Skip to content

Commit

Permalink
Create q8.gsql
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxiw authored Jan 21, 2025
1 parent 4279924 commit 7f05be4
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions demos/guru_scripts/docker/tutorial/4.x/script/q8.gsql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
USE GRAPH financialGraph

CREATE OR REPLACE DISTRIBUTED QUERY q8 () SYNTAX V3 {

SumAccum<int> @@edgeCnt = 0;
MaxAccum<int> @maxAmount = 0;
MinAccum<int> @minAmount = 100000;

MaxAccum<int> @@maxSenderAmount = 0;
MinAccum<int> @@minReceiverAmount = 100000;
SumAccum<int> @@bCnt = 0;
SumAccum<int> @@aCnt = 0;

S = SELECT b
FROM (a:Account) - [e:transfer] -> (b:Account)
WHERE NOT a.isBlocked
ACCUM a.@maxAmount += e.amount, //sender max amount
b.@minAmount += e.amount, //receiver min amount
@@edgeCnt +=1
POST-ACCUM (a) @@maxSenderAmount += a.@maxAmount
POST-ACCUM (b) @@minReceiverAmount += b.@minAmount
POST-ACCUM (a) @@aCnt +=1
POST-ACCUM (b) @@bCnt +=1 ;

PRINT @@maxSenderAmount, @@minReceiverAmount;
PRINT @@edgeCnt, @@aCnt, @@bCnt;

}

INSTALL QUERY q8


RUN QUERY q8()

0 comments on commit 7f05be4

Please sign in to comment.