Beispiel #1
0
// set the fields of the other time series to null making sure that
// the order of the null values match the order of the field
// definitions, i.e. left timeseries first followed by values from the
// right timeseries
func (self *mergeState) getPoint(fields []string, p *protocol.Point) *protocol.Point {
	if !self.modifyValues {
		return p
	}

	newValues := make([]*protocol.FieldValue, len(self.fields))
	oldValues := p.Values
	for idx, f := range fields {
		newIdx := self.fields[f]
		newValues[newIdx] = oldValues[idx]
	}
	p.Values = newValues
	return p
}
Beispiel #2
0
func filterColumns(columns map[string]struct{}, fields []string, point *protocol.Point) {
	if _, ok := columns["*"]; ok {
		return
	}

	newValues := []*protocol.FieldValue{}
	newFields := []string{}
	for idx, f := range fields {
		if _, ok := columns[f]; !ok {
			continue
		}

		newValues = append(newValues, point.Values[idx])
		newFields = append(newFields, f)
	}
	point.Values = newValues
}