mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
FieldValues: Use plain arrays instead of Vector (part 2 of 2) (#66224)
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
toDataFrame,
|
||||
ArrayVector,
|
||||
DataFrame,
|
||||
FieldType,
|
||||
toDataFrameDTO,
|
||||
@@ -344,6 +343,7 @@ describe('Prepare time series transformer', () => {
|
||||
};
|
||||
|
||||
const frames = prepareTimeSeriesTransformer.transformer(config, ctx)(source);
|
||||
|
||||
expect(frames).toEqual([
|
||||
toEquableDataFrame({
|
||||
name: 'wants-to-be-many',
|
||||
@@ -422,7 +422,6 @@ function toEquableDataFrame(source: any): DataFrame {
|
||||
fields: source.fields.map((field: any) => {
|
||||
return {
|
||||
...field,
|
||||
values: new ArrayVector(field.values),
|
||||
config: {},
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
FieldMatcherID,
|
||||
Field,
|
||||
MutableDataFrame,
|
||||
ArrayVector,
|
||||
} from '@grafana/data';
|
||||
import { Labels } from 'app/types/unified-alerting-dto';
|
||||
|
||||
@@ -115,11 +114,11 @@ export function toTimeSeriesMulti(data: DataFrame[]): DataFrame[] {
|
||||
fields: [
|
||||
{
|
||||
...timeField,
|
||||
values: new ArrayVector(b.time),
|
||||
values: b.time,
|
||||
},
|
||||
{
|
||||
...field,
|
||||
values: new ArrayVector(b.value),
|
||||
values: b.value,
|
||||
labels: b.labels,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -69,10 +69,7 @@ export function timeSeriesToTableTransform(options: TimeSeriesTableTransformerOp
|
||||
};
|
||||
refId2frameField[refId] = frameField;
|
||||
|
||||
// NOTE: MutableDataFrame.addField() makes copies, including any .values buffers
|
||||
// since we do .values.add() later on the *originals*, we pass a custom MutableVectorCreator
|
||||
// which will re-use the existing empty .values buffer by reference
|
||||
const table = new MutableDataFrame(undefined, (buffer) => buffer ?? []);
|
||||
const table = new MutableDataFrame();
|
||||
for (const label of Object.values(labelFields)) {
|
||||
table.addField(label);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user