Skip to content

Commit 5afe23d

Browse files
committed
matrix stats results
1 parent 2757f1d commit 5afe23d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Query/Processor.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,18 @@ protected function extractAggResult($type, $bucket, $key)
196196
return match ($type) {
197197
'count', 'avg', 'max', 'min', 'sum', 'median_absolute_deviation', 'value_count', 'cardinality' => $bucket[$key]['value'],
198198
'percentiles' => $bucket[$key]['values'],
199-
'matrix_stats' => $bucket[$key]['fields'][0],
199+
'matrix_stats' => $this->extractMatrixResult($bucket, $key),
200200
'extended_stats', 'stats', 'string_stats', 'boxplot' => $bucket[$key],
201201
};
202202
}
203203

204+
protected function extractMatrixResult($bucket, $key): ?array
205+
{
206+
$results = collect($bucket[$key]['fields']);
207+
208+
return $results->where('name', $key)->first();
209+
}
210+
204211
public function processDistinctAggregation($result, $metric)
205212
{
206213
return collect($this->parseDistinctBucketWithMetrics($result, $metric));

0 commit comments

Comments
 (0)