Skip to content

Commit fcab98b

Browse files
committed
add: complex read test and result
1 parent b49f88a commit fcab98b

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed

test/resource/cases/finbench/cypher/complex_read.result

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,26 @@ ORDER BY accountDistance, otherId, mediumId;
1818
[{"accountDistance":1,"mediumId":1,"mediumType":"Medium1","otherId":2},{"accountDistance":1,"mediumId":5,"mediumType":"Medium5","otherId":9},{"accountDistance":2,"mediumId":16,"mediumType":"Medium16","otherId":12}]
1919

2020

21+
# complex read 1
22+
MATCH p = (acc:Account {id:6})
23+
-[e1:transfer *1..3]
24+
->(other:Account)<-[e2:signIn]-(medium)
25+
WHERE
26+
isAsc(getMemberProp(e1, 'timestamp'))=true
27+
AND head(getMemberProp(e1, 'timestamp')) > 10
28+
AND last(getMemberProp(e1, 'timestamp')) < 30
29+
AND e2.timestamp > 10
30+
AND e2.timestamp < 30
31+
AND medium.isBlocked = true
32+
RETURN DISTINCT
33+
other.id as otherId,
34+
length(p)-1 as accountDistance,
35+
medium.id as mediumId,
36+
medium.type as mediumType
37+
ORDER BY accountDistance, otherId, mediumId;
38+
[{"accountDistance":1,"mediumId":19,"mediumType":"Medium19","otherId":1},{"accountDistance":2,"mediumId":8,"mediumType":"Medium8","otherId":18}]
39+
40+
2141
# complex read 2
2242
MATCH (p:Person {id:12})-[e1:own]->(acc:Account)
2343
<-[e2:transfer*1..3]-(other:Account)
@@ -42,6 +62,30 @@ ORDER BY sumLoanAmount DESC, otherId ASC;
4262
[{"otherId":6,"sumLoanAmount":279.0,"sumLoanBalance":134.0},{"otherId":17,"sumLoanAmount":157.0,"sumLoanBalance":25.0},{"otherId":14,"sumLoanAmount":85.0,"sumLoanBalance":51.0},{"otherId":18,"sumLoanAmount":57.0,"sumLoanBalance":80.0},{"otherId":5,"sumLoanAmount":16.0,"sumLoanBalance":28.0},{"otherId":0,"sumLoanAmount":13.0,"sumLoanBalance":0.0}]
4363

4464

65+
# complex read 2
66+
MATCH (p:Person {id:6})-[e1:own]->(acc:Account)
67+
<-[e2:transfer*1..3]-(other:Account)
68+
WHERE
69+
isDesc(getMemberProp(e2, 'timestamp'))=true
70+
AND head(getMemberProp(e2, 'timestamp')) < 30
71+
AND last(getMemberProp(e2, 'timestamp')) > 10
72+
WITH DISTINCT other
73+
MATCH (other)<-[e3:deposit]-(loan:Loan)
74+
WHERE
75+
e3.timestamp > 10
76+
AND e3.timestamp < 30
77+
WITH
78+
other.id AS otherId,
79+
sum(loan.loanAmount) as sumLoanAmount,
80+
sum(loan.balance) as sumLoanBalance
81+
RETURN
82+
otherId,
83+
round(sumLoanAmount * 1000) / 1000 as sumLoanAmount,
84+
round(sumLoanBalance * 1000) / 1000 as sumLoanBalance
85+
ORDER BY sumLoanAmount DESC, otherId ASC;
86+
[{"otherId":17,"sumLoanAmount":157.0,"sumLoanBalance":25.0},{"otherId":14,"sumLoanAmount":85.0,"sumLoanBalance":51.0},{"otherId":13,"sumLoanAmount":62.0,"sumLoanBalance":6.0},{"otherId":12,"sumLoanAmount":57.0,"sumLoanBalance":80.0}]
87+
88+
4589
# complex read 3
4690
MATCH (src:Account{id:2}), (dst:Account{id:3})
4791
CALL algo.shortestPath(
@@ -126,6 +170,23 @@ RETURN path;
126170
[{"path":[0,9]},{"path":[17,15]}]
127171

128172

173+
# complex read 5
174+
MATCH (person:Person {id: 6})-[e1:own]->(src:Account)
175+
WITH src
176+
MATCH p=(src)-[e2:transfer*1..3]->(dst:Account)
177+
WHERE
178+
isAsc(getMemberProp(e2, 'timestamp'))=true
179+
AND head(getMemberProp(e2, 'timestamp')) > 40
180+
AND last(getMemberProp(e2, 'timestamp')) < 45
181+
WITH DISTINCT
182+
getMemberProp(nodes(p), "id") as path,
183+
length(p) as len
184+
ORDER BY len DESC
185+
WHERE hasDuplicates(path)=false
186+
RETURN path;
187+
[{"path":[6,16]},{"path":[9,12]},{"path":[18,2]}]
188+
189+
129190
# complex read 6
130191
MATCH (dstCard:Account {id: 15} )<-[edge2:withdraw]-(mid:Account)
131192
WHERE
@@ -278,6 +339,24 @@ RETURN
278339
[{"numLoans":4,"sumLoanAmount":300.0}]
279340

280341

342+
# complex read 11
343+
MATCH
344+
(p1:Person {id:10})-[edge:guarantee*1..5]->(pN:Person)
345+
-[:apply]->(loan:Loan)
346+
WHERE
347+
minInList(getMemberProp(edge, 'timestamp')) > 10
348+
AND maxInList(getMemberProp(edge, 'timestamp')) < 50
349+
WITH
350+
DISTINCT loan
351+
WITH
352+
sum(loan.loanAmount) as sumLoanAmount,
353+
count(distinct loan) as numLoans
354+
RETURN
355+
round(sumLoanAmount * 1000) / 1000 as sumLoanAmount,
356+
numLoans;
357+
[{"numLoans":7,"sumLoanAmount":343.0}]
358+
359+
281360
# complex read 12
282361
MATCH
283362
(person:Person {id:12})-[edge1:own]->(pAcc:Account)

test/resource/cases/finbench/cypher/complex_read.test

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ RETURN DISTINCT
1717
ORDER BY accountDistance, otherId, mediumId;
1818

1919

20+
# complex read 1
21+
MATCH p = (acc:Account {id:6})
22+
-[e1:transfer *1..3]
23+
->(other:Account)<-[e2:signIn]-(medium)
24+
WHERE
25+
isAsc(getMemberProp(e1, 'timestamp'))=true
26+
AND head(getMemberProp(e1, 'timestamp')) > 10
27+
AND last(getMemberProp(e1, 'timestamp')) < 30
28+
AND e2.timestamp > 10
29+
AND e2.timestamp < 30
30+
AND medium.isBlocked = true
31+
RETURN DISTINCT
32+
other.id as otherId,
33+
length(p)-1 as accountDistance,
34+
medium.id as mediumId,
35+
medium.type as mediumType
36+
ORDER BY accountDistance, otherId, mediumId;
37+
38+
2039
# complex read 2
2140
MATCH (p:Person {id:12})-[e1:own]->(acc:Account)
2241
<-[e2:transfer*1..3]-(other:Account)
@@ -40,6 +59,29 @@ RETURN
4059
ORDER BY sumLoanAmount DESC, otherId ASC;
4160

4261

62+
# complex read 2
63+
MATCH (p:Person {id:6})-[e1:own]->(acc:Account)
64+
<-[e2:transfer*1..3]-(other:Account)
65+
WHERE
66+
isDesc(getMemberProp(e2, 'timestamp'))=true
67+
AND head(getMemberProp(e2, 'timestamp')) < 30
68+
AND last(getMemberProp(e2, 'timestamp')) > 10
69+
WITH DISTINCT other
70+
MATCH (other)<-[e3:deposit]-(loan:Loan)
71+
WHERE
72+
e3.timestamp > 10
73+
AND e3.timestamp < 30
74+
WITH
75+
other.id AS otherId,
76+
sum(loan.loanAmount) as sumLoanAmount,
77+
sum(loan.balance) as sumLoanBalance
78+
RETURN
79+
otherId,
80+
round(sumLoanAmount * 1000) / 1000 as sumLoanAmount,
81+
round(sumLoanBalance * 1000) / 1000 as sumLoanBalance
82+
ORDER BY sumLoanAmount DESC, otherId ASC;
83+
84+
4385
# complex read 3
4486
MATCH (src:Account{id:2}), (dst:Account{id:3})
4587
CALL algo.shortestPath(
@@ -121,6 +163,22 @@ WHERE hasDuplicates(path)=false
121163
RETURN path;
122164

123165

166+
# complex read 5
167+
MATCH (person:Person {id: 6})-[e1:own]->(src:Account)
168+
WITH src
169+
MATCH p=(src)-[e2:transfer*1..3]->(dst:Account)
170+
WHERE
171+
isAsc(getMemberProp(e2, 'timestamp'))=true
172+
AND head(getMemberProp(e2, 'timestamp')) > 40
173+
AND last(getMemberProp(e2, 'timestamp')) < 45
174+
WITH DISTINCT
175+
getMemberProp(nodes(p), "id") as path,
176+
length(p) as len
177+
ORDER BY len DESC
178+
WHERE hasDuplicates(path)=false
179+
RETURN path;
180+
181+
124182
# complex read 6
125183
MATCH (dstCard:Account {id: 15} )<-[edge2:withdraw]-(mid:Account)
126184
WHERE
@@ -267,6 +325,23 @@ RETURN
267325
numLoans;
268326

269327

328+
# complex read 11
329+
MATCH
330+
(p1:Person {id:10})-[edge:guarantee*1..5]->(pN:Person)
331+
-[:apply]->(loan:Loan)
332+
WHERE
333+
minInList(getMemberProp(edge, 'timestamp')) > 10
334+
AND maxInList(getMemberProp(edge, 'timestamp')) < 50
335+
WITH
336+
DISTINCT loan
337+
WITH
338+
sum(loan.loanAmount) as sumLoanAmount,
339+
count(distinct loan) as numLoans
340+
RETURN
341+
round(sumLoanAmount * 1000) / 1000 as sumLoanAmount,
342+
numLoans;
343+
344+
270345
# complex read 12
271346
MATCH
272347
(person:Person {id:12})-[edge1:own]->(pAcc:Account)

0 commit comments

Comments
 (0)