-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |