normalizeRows()

in src/app/services/bigquery.service.ts [222:243]


  normalizeRows(rows: Array<Object>, normalizedCols: Array<Object>, stats: Map<String, ColumnStat>) {
    return (rows || []).map((row) => {
      const rowObject = {};
      row['f'].forEach(({v}, index) => {
        const column = normalizedCols[index];
        if (column['type'] === ColumnType.NUMBER) {
          v = v === '' || v === null ? null : Number(v);
          rowObject[column['name']] = v;
          const stat = stats.get(column['name']);
          if (v === null) {
            stat.nulls++;
          } else {
            stat.max = Math.round(Math.max(stat.max, v) * 1000) / 1000;
            stat.min = Math.round(Math.min(stat.min, v) * 1000) / 1000;
          }
        } else {
          rowObject[column['name']] = v === null ? null : String(v);
        }
      });
      return rowObject;
    });
  }