code: func (sink *influxdbSink) parseAggregateQueryRow(rawRow influx_models.Row, aggregationLookup map[core.AggregationType]int, bucketSize time.Duration) ([]core.TimestampedAggregationValue, error) {
  	vals := make([]core.TimestampedAggregationValue, len(rawRow.Values))
  	wasInt := make(map[string]bool, len(aggregationLookup))
  
  	for i, rawVal := range rawRow.Values {
  		val := core.TimestampedAggregationValue{
  			BucketSize: bucketSize,
  			AggregationValue: core.AggregationValue{
  				Aggregations: map[core.AggregationType]core.MetricValue{},
  			},
  		}
  
  		if ts, err := time.Parse(time.RFC3339, rawVal[0].(string)); err != nil {
  			return nil, fmt.Errorf("Unable to parse timestamp %q in series %q", rawVal[0].(string), rawRow.Name)
  		} else {
  			val.Timestamp = ts
  		}
  
  		// The Influx client decods numeric fields to json.Number (a string), so we have to try decoding to both types of numbers
  
  		// Count is always a uint64
  		if countIndex, ok := aggregationLookup[core.AggregationTypeCount]; ok {
  			if err := json.Unmarshal([]byte(rawVal[countIndex].(json.Number).String()), &val.Count); err != nil {
  				glog.Errorf("Unable to parse count value in series %q: %v", rawRow.Name, err)
  				return nil, fmt.Errorf("Unable to parse values in series %q", rawRow.Name)
  			}
  		}
  
  		// The rest of the aggregation values can be either float or int, so attempt to parse both
  		if err := populateAggregations(rawRow.Name, rawVal, &val, aggregationLookup, wasInt); err != nil {
  			return nil, err
  		}
  
  		vals[i] = val
  	}
  
  	// figure out whether each aggregation was full of float values, or int values
  	setAggregationValueTypes(vals, wasInt)
  
  	return vals, nil
  }
docs: // parseRawQueryRow parses a set of timestamped aggregation values from unstructured JSON output into the
  // appropriate Heapster form