code: func (sink *influxdbSink) aggregationFunc(aggregationName core.AggregationType, fieldName string) string {
  	switch aggregationName {
  	case core.AggregationTypeAverage:
  		return fmt.Sprintf("MEAN(%q)", fieldName)
  	case core.AggregationTypeMaximum:
  		return fmt.Sprintf("MAX(%q)", fieldName)
  	case core.AggregationTypeMinimum:
  		return fmt.Sprintf("MIN(%q)", fieldName)
  	case core.AggregationTypeMedian:
  		return fmt.Sprintf("MEDIAN(%q)", fieldName)
  	case core.AggregationTypeCount:
  		return fmt.Sprintf("COUNT(%q)", fieldName)
  	case core.AggregationTypePercentile50:
  		return fmt.Sprintf("PERCENTILE(%q, 50)", fieldName)
  	case core.AggregationTypePercentile95:
  		return fmt.Sprintf("PERCENTILE(%q, 95)", fieldName)
  	case core.AggregationTypePercentile99:
  		return fmt.Sprintf("PERCENTILE(%q, 99)", fieldName)
  	}
  
  	// This should have been checked by the API level, so something's seriously wrong here
  	panic(fmt.Sprintf("Unknown aggregation type %q", aggregationName))
  }
docs: // aggregationFunc converts an aggregation name into the equivalent call to an InfluxQL
  // aggregation function