Skip to content

Commit b7b71ed

Browse files
committed
test: print AQL queries for all regression tests
This has mainly two use cases - Getting a general feeling of how queries are translated into AQL to discover potential for optimizations and simplifications - Double-checking that a code change does not change AQL in a bad way, even if you don't notice it in the result with the test data
1 parent 10f645c commit b7b71ed

File tree

608 files changed

+27145
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

608 files changed

+27145
-5
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
RETURN {
2+
"allFiles": (
3+
FOR v_file1
4+
IN (
5+
FOR v_item1
6+
IN @@files
7+
FILTER (v_item1.`accessGroup` IN @var1)
8+
RETURN v_item1
9+
)
10+
SORT (v_file1.`name`)
11+
RETURN {
12+
"name": v_file1.`name`
13+
}
14+
)
15+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
RETURN (@var1.`accessGroup` IN @var2)
2+
3+
// --------------------------------
4+
5+
RETURN FIRST(
6+
INSERT @var1 IN @@files
7+
RETURN NEW._key
8+
)
9+
10+
// --------------------------------
11+
12+
WITH @@files
13+
LET v_file1 = FIRST(
14+
LET v_entity1 = DOCUMENT(@@files, @v_newEntityId1)
15+
RETURN ((v_entity1.`accessGroup` IN @var1) ? v_entity1 : null)
16+
)
17+
RETURN (IS_NULL(v_file1) ? null : {
18+
"accessGroup": v_file1.`accessGroup`
19+
})
20+
21+
// --------------------------------
22+
23+
WITH @@files
24+
RETURN (@var1.`accessGroup` IN @var2)
25+
26+
// --------------------------------
27+
28+
WITH @@files
29+
RETURN FIRST(
30+
INSERT @var1 IN @@files
31+
RETURN NEW._key
32+
)
33+
34+
// --------------------------------
35+
36+
WITH @@files
37+
LET v_file1 = FIRST(
38+
LET v_entity1 = DOCUMENT(@@files, @v_newEntityId1)
39+
RETURN ((v_entity1.`accessGroup` IN @var1) ? v_entity1 : null)
40+
)
41+
RETURN (IS_NULL(v_file1) ? null : {
42+
"accessGroup": v_file1.`accessGroup`
43+
})
44+
45+
// --------------------------------
46+
47+
WITH @@files
48+
RETURN (@var1.`accessGroup` IN @var2)
49+
50+
// --------------------------------
51+
52+
WITH @@files
53+
RETURN FIRST(
54+
INSERT @var1 IN @@files
55+
RETURN NEW._key
56+
)
57+
58+
// --------------------------------
59+
60+
WITH @@files
61+
LET v_file1 = FIRST(
62+
LET v_entity1 = DOCUMENT(@@files, @v_newEntityId1)
63+
RETURN ((v_entity1.`accessGroup` IN @var1) ? v_entity1 : null)
64+
)
65+
RETURN (IS_NULL(v_file1) ? null : {
66+
"accessGroup": v_file1.`accessGroup`
67+
})
68+
69+
// --------------------------------
70+
71+
WITH @@files
72+
RETURN {
73+
"f1": @v_createFile1,
74+
"f2": @v_createFile2,
75+
"f3": @v_createFile3
76+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
RETURN {
2+
"allFiles": (
3+
FOR v_file1
4+
IN (
5+
FOR v_item1
6+
IN @@files
7+
FILTER (v_item1.`accessGroup` IN @var1)
8+
RETURN v_item1
9+
)
10+
SORT (v_file1.`name`)
11+
RETURN {
12+
"name": v_file1.`name`,
13+
"accessGroup": v_file1.`accessGroup`
14+
}
15+
)
16+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
RETURN (@var1.`accessGroup` IN @var2)
2+
3+
// --------------------------------
4+
5+
RETURN FIRST(
6+
INSERT @var1 IN @@files
7+
RETURN NEW._key
8+
)
9+
10+
// --------------------------------
11+
12+
WITH @@files
13+
LET v_file1 = FIRST(
14+
LET v_entity1 = DOCUMENT(@@files, @v_newEntityId1)
15+
RETURN ((v_entity1.`accessGroup` IN @var1) ? v_entity1 : null)
16+
)
17+
RETURN (IS_NULL(v_file1) ? null : {
18+
"accessGroup": v_file1.`accessGroup`
19+
})
20+
21+
// --------------------------------
22+
23+
WITH @@files
24+
RETURN {
25+
"createFile": @v_createFile1
26+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RETURN {
2+
"flexSearchFiles": { __cruddl_runtime_error_code: @var1, __cruddl_runtime_error: @var2 }
3+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
RETURN (FIRST(
2+
FOR v_item1
3+
IN (
4+
FOR v_file1
5+
IN (
6+
FOR v_file2
7+
IN (
8+
FOR v_item2
9+
IN @@files
10+
FILTER (v_item2.`accessGroup` IN @var1)
11+
RETURN v_item2
12+
)
13+
FILTER (v_file2._key == @var2)
14+
RETURN v_file2
15+
)
16+
FILTER !((v_file1.`accessGroup` IN @var3))
17+
RETURN v_file1
18+
)
19+
COLLECT WITH COUNT INTO v_count1
20+
RETURN v_count1
21+
) == 0)
22+
23+
// --------------------------------
24+
25+
RETURN (
26+
FOR v_File1
27+
IN (
28+
FOR v_file1
29+
IN (
30+
FOR v_item1
31+
IN @@files
32+
FILTER (v_item1.`accessGroup` IN @var1)
33+
RETURN v_item1
34+
)
35+
FILTER (v_file1._key == @var2)
36+
REMOVE v_file1
37+
IN @@files
38+
RETURN OLD
39+
)
40+
RETURN {
41+
"name": v_File1.`name`
42+
}
43+
)
44+
45+
// --------------------------------
46+
47+
RETURN {
48+
"deleteAllFiles": @v_deleteAllFiles1
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
RETURN (FIRST(
2+
FOR v_item1
3+
IN (
4+
FOR v_file1
5+
IN (
6+
FOR v_file2
7+
IN (
8+
FOR v_item2
9+
IN @@files
10+
FILTER (v_item2.`accessGroup` IN @var1)
11+
RETURN v_item2
12+
)
13+
FILTER (v_file2._key == @var2)
14+
RETURN v_file2
15+
)
16+
FILTER !((v_file1.`accessGroup` IN @var3))
17+
RETURN v_file1
18+
)
19+
COLLECT WITH COUNT INTO v_count1
20+
RETURN v_count1
21+
) == 0)
22+
23+
// --------------------------------
24+
25+
RETURN (
26+
FOR v_File1
27+
IN (
28+
FOR v_file1
29+
IN (
30+
FOR v_item1
31+
IN @@files
32+
FILTER (v_item1.`accessGroup` IN @var1)
33+
RETURN v_item1
34+
)
35+
FILTER (v_file1._key == @var2)
36+
REMOVE v_file1
37+
IN @@files
38+
RETURN OLD
39+
)
40+
RETURN {
41+
"name": v_File1.`name`
42+
}
43+
)
44+
45+
// --------------------------------
46+
47+
RETURN {
48+
"deleteAllFiles": @v_deleteAllFiles1
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
RETURN (FIRST(
2+
FOR v_item1
3+
IN (
4+
FOR v_file1
5+
IN (
6+
FOR v_file2
7+
IN (
8+
FOR v_item2
9+
IN @@files
10+
FILTER (v_item2.`accessGroup` IN @var1)
11+
RETURN v_item2
12+
)
13+
FILTER (v_file2._key == @var2)
14+
RETURN v_file2
15+
)
16+
FILTER !((v_file1.`accessGroup` IN @var3))
17+
RETURN v_file1
18+
)
19+
COLLECT WITH COUNT INTO v_count1
20+
RETURN v_count1
21+
) == 0)
22+
23+
// --------------------------------
24+
25+
RETURN (
26+
FOR v_File1
27+
IN (
28+
FOR v_file1
29+
IN (
30+
FOR v_item1
31+
IN @@files
32+
FILTER (v_item1.`accessGroup` IN @var1)
33+
RETURN v_item1
34+
)
35+
FILTER (v_file1._key == @var2)
36+
REMOVE v_file1
37+
IN @@files
38+
RETURN OLD
39+
)
40+
RETURN {
41+
"name": v_File1.`name`
42+
}
43+
)
44+
45+
// --------------------------------
46+
47+
RETURN {
48+
"deleteAllFiles": @v_deleteAllFiles1
49+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
RETURN (FIRST(
2+
FOR v_item1
3+
IN (
4+
FOR v_file1
5+
IN (
6+
FOR v_file2
7+
IN (
8+
FOR v_item2
9+
IN @@files
10+
FILTER (v_item2.`accessGroup` IN @var1)
11+
RETURN v_item2
12+
)
13+
FILTER (v_file2._key == @var2)
14+
RETURN v_file2
15+
)
16+
FILTER !((v_file1.`accessGroup` IN @var3))
17+
RETURN v_file1
18+
)
19+
COLLECT WITH COUNT INTO v_count1
20+
RETURN v_count1
21+
) == 0)
22+
23+
// --------------------------------
24+
25+
RETURN (FIRST(
26+
FOR v_item1
27+
IN (
28+
FOR v_currentEntity1
29+
IN (
30+
FOR v_file1
31+
IN (
32+
FOR v_item2
33+
IN @@files
34+
FILTER (v_item2.`accessGroup` IN @var1)
35+
RETURN v_item2
36+
)
37+
FILTER (v_file1._key == @var2)
38+
RETURN v_file1
39+
)
40+
FILTER !((MERGE(v_currentEntity1, {
41+
"name": @var3,
42+
"updatedAt": @var4
43+
}).`accessGroup` IN @var5))
44+
RETURN v_currentEntity1
45+
)
46+
COLLECT WITH COUNT INTO v_count1
47+
RETURN v_count1
48+
) == 0)
49+
50+
// --------------------------------
51+
52+
RETURN (
53+
FOR v_currentEntity1
54+
IN (
55+
FOR v_file1
56+
IN (
57+
FOR v_item1
58+
IN @@files
59+
FILTER (v_item1.`accessGroup` IN @var1)
60+
RETURN v_item1
61+
)
62+
FILTER (v_file1._key == @var2)
63+
RETURN v_file1
64+
)
65+
UPDATE v_currentEntity1
66+
WITH {
67+
"name": @var3,
68+
"updatedAt": @var4
69+
}
70+
IN @@files
71+
OPTIONS { mergeObjects: false }
72+
RETURN NEW._key
73+
)
74+
75+
// --------------------------------
76+
77+
WITH @@files
78+
RETURN (
79+
FOR v_File1
80+
IN (
81+
FOR v_id1
82+
IN @v_updatedIds1
83+
LET v_entity1 = DOCUMENT(@@files, v_id1)
84+
RETURN ((v_entity1.`accessGroup` IN @var1) ? v_entity1 : null)
85+
)
86+
RETURN {
87+
"name": v_File1.`name`
88+
}
89+
)
90+
91+
// --------------------------------
92+
93+
WITH @@files
94+
RETURN {
95+
"updateAllFiles": @v_updateAllFiles1
96+
}

0 commit comments

Comments
 (0)