Skip to content

Commit 8d688c8

Browse files
committed
winp
1 parent c0fb334 commit 8d688c8

File tree

5 files changed

+170
-15
lines changed

5 files changed

+170
-15
lines changed

src/Neo4jQueryAPI.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use GuzzleHttp\Client;
77
use GuzzleHttp\Exception\GuzzleException;
88
use GuzzleHttp\Exception\RequestException;
9-
use Neo4j\QueryAPI\Objects\ChildQueryPlan;
109
use Neo4j\QueryAPI\Objects\ProfiledQueryPlanArguments;
1110
use Neo4j\QueryAPI\Objects\ResultCounters;
1211
use Neo4j\QueryAPI\Objects\ProfiledQueryPlan;

src/Objects/ProfiledQueryPlan.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ProfiledQueryPlan extends \Neo4j\QueryAPI\Objects\Bookmarks
1515
private ProfiledQueryPlanArguments $arguments;
1616

1717
/**
18-
* @var list<ProfiledQueryPlan>
18+
* @var list<ProfiledQueryPlan|ProfiledQueryPlanArguments>
1919
*/
2020
private array $children;
2121

@@ -28,8 +28,8 @@ public function __construct(
2828
?float $pageCacheHitRatio = 0.0,
2929
?int $time = 0,
3030
?string $operatorType = '',
31-
ProfiledQueryPlanArguments $arguments,
32-
31+
ProfiledQueryPlanArguments $arguments ,
32+
array $children = [] // Accept an array of children, default to empty array
3333
) {
3434
$this->dbHits = $dbHits ?? 0;
3535
$this->records = $records ?? 0;
@@ -40,6 +40,7 @@ public function __construct(
4040
$this->time = $time ?? 0;
4141
$this->operatorType = $operatorType ?? '';
4242
$this->arguments = $arguments;
43+
$this->children = $children ?? [];
4344
}
4445

4546
public function getDbHits(): int
@@ -88,14 +89,14 @@ public function getArguments(): ProfiledQueryPlanArguments
8889
}
8990

9091
/**
91-
* @return list<ProfiledQueryPlan>
92+
* @return list<ProfiledQueryPlan|ProfiledQueryPlanArguments>
9293
*/
93-
public function getChildren(): array
94+
public function getChildren(): array
9495
{
9596
return $this->children;
9697
}
9798

98-
public function addChild(ProfiledQueryPlan $child): void
99+
public function addChild(ProfiledQueryPlan|ProfiledQueryPlanArguments $child): void
99100
{
100101
$this->children[] = $child;
101102
}

src/Results/ResultSet.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public function __construct(
2121
private readonly array $rows,
2222
private ResultCounters $counters,
2323
private Bookmarks $bookmarks,
24-
private ?ProfiledQueryPlan $profiledQueryPlan = null
24+
private ?ProfiledQueryPlan $profiledQueryPlan = null,
25+
private ?ProfiledQueryPlanArguments $profiledQueryPlanArguments = null
2526
)
2627
{
2728
}

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

Lines changed: 160 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
null,
200200
0,
201201
null,
202-
"range($autoint_2, $autoint_3) AS j",
202+
"range(\$autoint_2, \$autoint_3) AS j",
203203
null,
204204
"Fused in Pipeline 0",
205205
null,
@@ -231,7 +231,7 @@
231231
null,
232232
0,
233233
null,
234-
"range($autoint_0, $autoint_1) AS i",
234+
"range(\$autoint_0, \$autoint_1) AS i",
235235
null,
236236
"Fused in Pipeline 0",
237237
null,
@@ -273,7 +273,164 @@
273273
null,
274274
0
275275
)
276-
)
276+
),
277+
278+
[
279+
new ProfiledQueryPlan(
280+
0,
281+
0,
282+
false,
283+
0,
284+
0,
285+
0.0,
286+
0,
287+
"CartesianProduct@neo4j",
288+
new ProfiledQueryPlanArguments(
289+
null,
290+
null,
291+
1392,
292+
null,
293+
null,
294+
0,
295+
0,
296+
0,
297+
null,
298+
0,
299+
null,
300+
null,
301+
null,
302+
"In Pipeline 3",
303+
null,
304+
5,
305+
7.5,
306+
null,
307+
0
308+
)
309+
),
310+
new ProfiledQueryPlan(
311+
2027,
312+
0,
313+
false,
314+
0,
315+
0,
316+
0.0,
317+
0,
318+
"Filter@neo4j",
319+
new ProfiledQueryPlanArguments(
320+
"rand() < \$autodouble_4 AND cache[a.id] = i",
321+
"Fused in Pipeline 1",
322+
8,
323+
null,
324+
null,
325+
2027,
326+
0,
327+
0,
328+
null,
329+
0,
330+
null,
331+
null,
332+
null,
333+
null,
334+
null,
335+
15.0,
336+
null,
337+
0
338+
)
339+
),
340+
new ProfiledQueryPlan(
341+
30000,
342+
20000,
343+
true,
344+
10002,
345+
0,
346+
1.0,
347+
6157670,
348+
"NodeByLabelScan@neo4j",
349+
new ProfiledQueryPlanArguments(
350+
"a:Person",
351+
"Fused in Pipeline 1",
352+
9,
353+
null,
354+
null,
355+
30000,
356+
20000,
357+
0,
358+
null,
359+
10002,
360+
null,
361+
null,
362+
null,
363+
null,
364+
null,
365+
1000.0,
366+
null,
367+
6157670
368+
)
369+
),
370+
new ProfiledQueryPlan(
371+
0,
372+
0,
373+
false,
374+
0,
375+
0,
376+
0.0,
377+
0,
378+
"Filter@neo4j",
379+
new ProfiledQueryPlanArguments(
380+
"cache[b.id] = j",
381+
"Fused in Pipeline 2",
382+
6,
383+
null,
384+
null,
385+
0,
386+
0,
387+
0,
388+
null,
389+
0,
390+
null,
391+
null,
392+
null,
393+
null,
394+
null,
395+
50.0,
396+
null,
397+
0
398+
)
399+
),
400+
401+
new ProfiledQueryPlan(
402+
0,
403+
0,
404+
false,
405+
0,
406+
0,
407+
0.0,
408+
0,
409+
"NodeByLabelScan@neo4j",
410+
new ProfiledQueryPlanArguments(
411+
"b:Person",
412+
"Fused in Pipeline 2",
413+
7,
414+
null,
415+
null,
416+
0,
417+
0,
418+
0,
419+
null,
420+
0,
421+
null,
422+
null,
423+
null,
424+
null,
425+
null,
426+
1000.0,
427+
null,
428+
0
429+
)
430+
)
431+
432+
]
433+
277434
]
278435

279436
]
@@ -290,9 +447,6 @@
290447
)
291448
]
292449

293-
294-
295-
296450
)
297451

298452

0 commit comments

Comments
 (0)