Skip to content

Commit c0fb334

Browse files
committed
winp
1 parent 76aabab commit c0fb334

File tree

6 files changed

+254
-15
lines changed

6 files changed

+254
-15
lines changed

src/Neo4jQueryAPI.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use GuzzleHttp\Exception\GuzzleException;
88
use GuzzleHttp\Exception\RequestException;
99
use Neo4j\QueryAPI\Objects\ChildQueryPlan;
10-
use Neo4j\QueryAPI\Objects\QueryArguments;
10+
use Neo4j\QueryAPI\Objects\ProfiledQueryPlanArguments;
1111
use Neo4j\QueryAPI\Objects\ResultCounters;
1212
use Neo4j\QueryAPI\Objects\ProfiledQueryPlan;
1313
use Neo4j\QueryAPI\Results\ResultRow;
@@ -136,13 +136,14 @@ private function createProfileData(array $data): ProfiledQueryPlan
136136
$mappedArguments[$key] = $ogm->map($value);
137137
}
138138

139-
$queryArguments = new QueryArguments(
139+
$queryArguments = new ProfiledQueryPlanArguments(
140140
$mappedArguments['globalMemory'],
141141
$mappedArguments['plannerImpl'],
142142
$mappedArguments['memory'],
143143
$mappedArguments['stringRepresentation'],
144144
is_string($mappedArguments['runtime'] ? $mappedArguments['runtime'] : json_encode($mappedArguments['runtime'])),
145145
$mappedArguments['time'],
146+
$mappedArguments['pageCacheMisses'],
146147
$mappedArguments['runtimeImpl'],
147148
$mappedArguments['dbHits'],
148149
$mappedArguments['batchSize'],

src/Objects/ProfiledQueryPlan.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Neo4j\QueryAPI\Objects;
44

5-
class ProfiledQueryPlan
5+
class ProfiledQueryPlan extends \Neo4j\QueryAPI\Objects\Bookmarks
66
{
77
private int $dbHits;
88
private int $records;
@@ -12,7 +12,7 @@ class ProfiledQueryPlan
1212
private float $pageCacheHitRatio;
1313
private int $time;
1414
private string $operatorType;
15-
private QueryArguments $arguments;
15+
private ProfiledQueryPlanArguments $arguments;
1616

1717
/**
1818
* @var list<ProfiledQueryPlan>
@@ -28,7 +28,8 @@ public function __construct(
2828
?float $pageCacheHitRatio = 0.0,
2929
?int $time = 0,
3030
?string $operatorType = '',
31-
QueryArguments $arguments
31+
ProfiledQueryPlanArguments $arguments,
32+
3233
) {
3334
$this->dbHits = $dbHits ?? 0;
3435
$this->records = $records ?? 0;
@@ -81,7 +82,7 @@ public function getOperatorType(): string
8182
return $this->operatorType;
8283
}
8384

84-
public function getArguments(): QueryArguments
85+
public function getArguments(): ProfiledQueryPlanArguments
8586
{
8687
return $this->arguments;
8788
}

src/Objects/QueryArguments.php renamed to src/Objects/ProfiledQueryPlanArguments.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Neo4j\QueryAPI\Objects;
44

5-
class QueryArguments
5+
class ProfiledQueryPlanArguments
66
{
77
public function __construct(
88
private readonly ?int $globalMemory = null,
@@ -11,6 +11,8 @@ public function __construct(
1111
private readonly ?string $stringRepresentation = null,
1212
private readonly ?string $runtime = null,
1313
private readonly ?int $time = null,
14+
private readonly ?int $pageCacheMisses = null,
15+
private readonly ?int $pageCacheHits = null,
1416
private readonly ?string $runtimeImpl = null,
1517
private readonly ?int $dbHits = null,
1618
private readonly ?int $batchSize = null,
@@ -55,7 +57,15 @@ public function getTime(): int
5557
{
5658
return $this->time;
5759
}
60+
public function getPageCacheMisses(): int
61+
{
62+
return $this->pageCacheMisses;
63+
}
5864

65+
private function getPageCacheHits():int
66+
{
67+
return $this->pageCacheHits;
68+
}
5969
public function getRuntimeImpl(): string
6070
{
6171
return $this->runtimeImpl;

src/Results/ResultSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use IteratorAggregate;
88
use Neo4j\QueryAPI\Objects\ChildQueryPlan;
99
use Neo4j\QueryAPI\Objects\ProfiledQueryPlan;
10-
use Neo4j\QueryAPI\Objects\QueryArguments;
10+
use Neo4j\QueryAPI\Objects\ProfiledQueryPlanArguments;
1111
use Neo4j\QueryAPI\Objects\ResultCounters;
1212
use Neo4j\QueryAPI\Objects\Bookmarks; // Make sure to include the Bookmarks class
1313
use Traversable;

tests/resources/expected/complex-query-profile.php

Lines changed: 233 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
use Neo4j\QueryAPI\Objects\ProfiledQueryPlan;
4-
use Neo4j\QueryAPI\Objects\QueryArguments;
4+
use Neo4j\QueryAPI\Objects\ProfiledQueryPlanArguments;
55
use Neo4j\QueryAPI\Objects\ResultCounters;
66
use Neo4j\QueryAPI\Results\ResultSet;
77

@@ -32,7 +32,7 @@
3232
0.0,
3333
0,
3434
"ProducerResults@neo4j",
35-
new QueryArguments(
35+
new ProfiledQueryPlanArguments(
3636
10624,
3737
"IDP",
3838
0,
@@ -60,13 +60,240 @@
6060
0.0,
6161
0,
6262
"EmptyResult@neo4j",
63-
new QueryArguments(
64-
pipelineInfo: "In Pipeline 3",
65-
time:0,
63+
new ProfiledQueryPlanArguments(
64+
"null",
65+
null,
66+
null,
67+
null,
68+
null,
69+
0,
70+
0,
71+
0,
72+
null,
73+
0,
74+
null,
75+
null,
76+
null,
77+
"In Pipeline 3",
78+
null,
79+
0,
80+
2.25,
81+
null,
82+
0
83+
),
84+
[
85+
new ProfiledQueryPlan(
86+
0,
87+
0,
88+
false,
89+
0,
90+
0,
91+
0.0,
92+
0,
93+
"Create@neo4j",
94+
new ProfiledQueryPlanArguments(
95+
null,
96+
"In Pipeline 3",
97+
0,
98+
0,
99+
null,
100+
0,
101+
2.25,
102+
0,
103+
0,
104+
0,
105+
null,
106+
"(a)-[anon_0:KNOWS]->(b), (b)-[anon_1:KNOWS]->(a)",
107+
null,
108+
"In Pipeline 3",
109+
null,
110+
2,
111+
2.25,
112+
null,
113+
0
114+
)
115+
),
116+
[
117+
new ProfiledQueryPlan(
118+
0,
119+
0,
120+
false,
121+
0,
122+
0,
123+
0.0,
124+
0,
125+
"Filter@neo4j",
126+
new ProfiledQueryPlanArguments(
127+
null,
128+
null,
129+
null,
130+
null,
131+
null,
132+
0,
133+
0,
134+
0,
135+
null,
136+
0,
137+
null,
138+
"cache[a.id] < cache[b.id]",
139+
null,
140+
"In Pipeline 3",
141+
null,
142+
3,
143+
2.25,
144+
null,
145+
0
146+
)
147+
),
148+
[
149+
new ProfiledQueryPlan(
150+
0,
151+
0,
152+
false,
153+
0,
154+
0,
155+
0.0,
156+
0,
157+
"Apply@neo4j",
158+
new ProfiledQueryPlanArguments(
159+
null,
160+
null,
161+
null,
162+
null,
163+
null,
164+
0,
165+
0,
166+
0,
167+
null,
168+
0,
169+
null,
170+
null,
171+
null,
172+
null,
173+
null,
174+
4,
175+
7.5,
176+
null,
177+
0
178+
)
179+
),
180+
[
181+
new ProfiledQueryPlan(
182+
0,
183+
10000,
184+
false,
185+
0,
186+
0,
187+
0.0,
188+
0,
189+
"Unwind@neo4j",
190+
new ProfiledQueryPlanArguments(
191+
null,
192+
null,
193+
null,
194+
null,
195+
null,
196+
0,
197+
0,
198+
0,
199+
null,
200+
0,
201+
null,
202+
"range($autoint_2, $autoint_3) AS j",
203+
null,
204+
"Fused in Pipeline 0",
205+
null,
206+
10,
207+
100.0,
208+
null,
209+
10000
210+
)
211+
),
212+
[
213+
new ProfiledQueryPlan(
214+
0,
215+
100,
216+
false,
217+
0,
218+
0,
219+
0.0,
220+
0,
221+
"Unwind@neo4j",
222+
new ProfiledQueryPlanArguments(
223+
null,
224+
null,
225+
null,
226+
null,
227+
null,
228+
0,
229+
0,
230+
0,
231+
null,
232+
0,
233+
null,
234+
"range($autoint_0, $autoint_1) AS i",
235+
null,
236+
"Fused in Pipeline 0",
237+
null,
238+
11,
239+
10.0,
240+
null,
241+
100
242+
)
243+
),
244+
[
245+
[
246+
new ProfiledQueryPlan(
247+
0,
248+
0,
249+
false,
250+
0,
251+
0,
252+
0.0,
253+
0,
254+
"CartesianProduct@neo4j",
255+
new ProfiledQueryPlanArguments(
256+
null,
257+
null,
258+
1392,
259+
null,
260+
null,
261+
0,
262+
0,
263+
0,
264+
null,
265+
0,
266+
null,
267+
null,
268+
null,
269+
"In Pipeline 3",
270+
null,
271+
5,
272+
7.5,
273+
null,
274+
0
275+
)
276+
)
277+
]
66278

67-
)
279+
]
280+
]
281+
282+
]
283+
284+
]
285+
286+
]
287+
288+
289+
]
68290
)
69291
]
292+
293+
294+
295+
70296
)
71297

298+
72299
);

tests/resources/responses/complex-query-profile.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@
298298
}
299299
},
300300
"identifiers" : [ "i" ],
301-
"children" : [ ]
301+
"children" : [ ] /*till here */
302302
} ]
303303
}, {
304304
"dbHits" : 0,

0 commit comments

Comments
 (0)