mirror of
https://github.com/grafana/grafana.git
synced 2026-07-30 08:18:10 -05:00
ArrowDataFrame: allow empty results (#22524)
This commit is contained in:
@@ -37,6 +37,13 @@ describe('GEL Utils', () => {
|
||||
const norm = frames.map(f => toDataFrameDTO(f));
|
||||
expect(norm).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('processEmptyResults', () => {
|
||||
const frames = resultsToDataFrames({
|
||||
results: { '': { refId: '', meta: null, series: null, tables: null, dataframes: null } },
|
||||
});
|
||||
expect(frames.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Read/Write arrow Table to DataFrame', () => {
|
||||
|
||||
@@ -146,9 +146,12 @@ export function grafanaDataFrameToArrowTable(data: DataFrame): Table {
|
||||
export function resultsToDataFrames(rsp: any): DataFrame[] {
|
||||
const frames: DataFrame[] = [];
|
||||
for (const res of Object.values(rsp.results)) {
|
||||
for (const b of (res as any).dataframes) {
|
||||
const t = base64StringToArrowTable(b as string);
|
||||
frames.push(arrowTableToDataFrame(t));
|
||||
const r = res as any;
|
||||
if (r.dataframes) {
|
||||
for (const b of r.dataframes) {
|
||||
const t = base64StringToArrowTable(b as string);
|
||||
frames.push(arrowTableToDataFrame(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
return frames;
|
||||
|
||||
Reference in New Issue
Block a user