DataFrame processing: Require table rows to be array (#20357)

(cherry picked from commit 4260cd548f)
This commit is contained in:
Šimon Podlipský
2019-11-14 08:33:19 -05:00
committed by Kyle Brandt
parent 0773ae80ea
commit a8f13bb0c1
2 changed files with 14 additions and 3 deletions
@@ -1,7 +1,5 @@
// Libraries
import isNumber from 'lodash/isNumber';
import isString from 'lodash/isString';
import isBoolean from 'lodash/isBoolean';
import { isArray, isBoolean, isNumber, isString } from 'lodash';
// Types
import {
@@ -34,6 +32,10 @@ function convertTableToDataFrame(table: TableData): DataFrame {
};
});
if (!isArray(table.rows)) {
throw new Error(`Expected table rows to be array, got ${typeof table.rows}.`);
}
for (const row of table.rows) {
for (let i = 0; i < fields.length; i++) {
fields[i].values.buffer.push(row[i]);